angular-cli: npm link doesn't work with 1.5.4 version

Versions

npm 5.5.1
node 8.9.0
angular 5.0.1
angular-cli 1.5.4
Windows 10

Repro steps

  • Generate project using ng new some-project
  • Create module and link @scope/mymodule
  • Compile module using ngc
  • Link module npm link
  • Link module to project cd some-project && npm link @scope/mymodule
  • Start project ng serve

Observed behavior

Error: StaticInjectorError[NgZone]: 
  StaticInjectorError[NgZone]: 
    NullInjectorError: No provider for NgZone!
    at _NullInjector.get (core.js:924)
    at resolveToken (core.js:1212)
    at tryResolveToken (core.js:1154)
    at StaticInjector.get (core.js:1025)
    at resolveToken (core.js:1212)
    at tryResolveToken (core.js:1154)
    at StaticInjector.get (core.js:1025)
    at resolveNgModuleDep (core.js:10586)
    at _createClass (core.js:10631)
    at _createProviderInstance$1 (core.js:10597)

Desired behavior

The module is linked to project, errors are missing.

Mention any other details that might be useful (optional)

If I delete my @angular folder from a linked module, the application runs as expected. I wrote console.log on each @angular/core file (project and library, @angular/core/esm5/core.js) and revealed that project(some-project) used first @angular/core module while library(@scope/mymodule) used it’s own @angular/core not root folder(node_modules) which is placed in the project directory.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 6
  • Comments: 15 (2 by maintainers)

Most upvoted comments

Maybe my fault,try “–preserve-symlinks”.