Skip to content

Angular fails to build #5682

@uspasojevic96

Description

@uspasojevic96

Current Behavior

Fresh Angular app does not build with nx build app-name

Expected Behavior

Fresh Angular app should be able to build when it's been freshly generated

Steps to Reproduce

  • Create fresh workspace (empty)
  • Add NestJS support
  • Generate NestJS app
  • Add Angular support
  • Generate Angular app
  • run nx build for the generated Angular app

Failure Logs

dev on  master [✘!+] is 📦 v0.0.0 via ⬢ v14.16.0 took 11s
➜ nx build tic-tac-toe-revolution-ui

> nx run tic-tac-toe-revolution-ui:build:production
⠋ Generating browser application bundles...(node:46741) UnhandledPromiseRejectionWarning: TypeError: webpack_1.node.NodeTargetPlugin is not a constructor
    at WebpackResourceLoader._compile (/Users/uros/workspace/dev/node_modules/@ngtools/webpack/src/resource_loader.js:83:13)
    at WebpackResourceLoader.get (/Users/uros/workspace/dev/node_modules/@ngtools/webpack/src/resource_loader.js:210:44)
    at Object.resourceHost.readResource (/Users/uros/workspace/dev/node_modules/@ngtools/webpack/src/ivy/host.js:30:35)
    at AdapterResourceLoader.preload (/Users/uros/workspace/dev/node_modules/@angular/compiler-cli/src/ngtsc/resource/src/loader.js:88:39)
    at resolveStyleUrl (/Users/uros/workspace/dev/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/component.js:192:49)
    at /Users/uros/workspace/dev/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/component.js:233:83
    at Array.map (<anonymous>)
    at ComponentDecoratorHandler.preanalyze (/Users/uros/workspace/dev/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/component.js:233:50)
    at _loop_1 (/Users/uros/workspace/dev/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:321:53)
    at TraitCompiler.analyzeClass (/Users/uros/workspace/dev/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:343:35)
    at visit (/Users/uros/workspace/dev/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:113:27)
    at visitNodes (/Users/uros/workspace/dev/node_modules/typescript/lib/typescript.js:28217:30)
    at Object.forEachChild (/Users/uros/workspace/dev/node_modules/typescript/lib/typescript.js:28456:24)
    at visit (/Users/uros/workspace/dev/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:115:20)
    at TraitCompiler.analyze (/Users/uros/workspace/dev/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:117:13)
    at TraitCompiler.analyzeAsync (/Users/uros/workspace/dev/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:79:25)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:46741) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:46741) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
✔ Browser application bundle generation complete.

Error: NormalModuleFactory.beforeResolve (NormalModuleReplacementPlugin) is no longer a waterfall hook, but a bailing hook instead. Do not return the passed object, but modify it instead. Returning false will ignore the request and results in no module created.

Error: NormalModuleFactory.beforeResolve (NormalModuleReplacementPlugin) is no longer a waterfall hook, but a bailing hook instead. Do not return the passed object, but modify it instead. Returning false will ignore the request and results in no module created.

Error: NormalModuleFactory.beforeResolve (NormalModuleReplacementPlugin) is no longer a waterfall hook, but a bailing hook instead. Do not return the passed object, but modify it instead. Returning false will ignore the request and results in no module created.

Environment

dev on  master [✘!+] is 📦 v0.0.0 via ⬢ v14.16.0 took 6s
➜ nx report

>  NX  Report complete - copy this into the issue template

  Node : 14.16.0
  OS   : darwin x64
  npm  : 7.9.0

  nx : Not Found
  @nrwl/angular : 12.3.3
  @nrwl/cli : 12.3.3
  @nrwl/cypress : 12.3.3
  @nrwl/devkit : 12.3.3
  @nrwl/eslint-plugin-nx : 12.3.3
  @nrwl/express : Not Found
  @nrwl/jest : 12.3.3
  @nrwl/linter : 12.3.3
  @nrwl/nest : 12.3.3
  @nrwl/next : Not Found
  @nrwl/node : 12.3.3
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.3.3
  @nrwl/web : Not Found
  @nrwl/workspace : 12.3.3
  @nrwl/storybook : Not Found
  @nrwl/gatsby : Not Found
  typescript : 4.2.4

Edit

I don't know why nx report isn't detecting nx:

dev on  master [✘!+] is 📦 v0.0.0 via ⬢ v14.16.0
➜ nx --version
12.3.3

dev on  master [✘!+] is 📦 v0.0.0 via ⬢ v14.16.0
➜ which nx
/Users/uros/.nvm/versions/node/v14.16.0/bin/nx

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedscope: angularIssues related to Angular support in Nxscope: nodeIssues related to Node, Express, NestJS support for Nxtype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions