angular-cli: I am on Angular 5 and CLI 1.5 and I get an error

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

Angular CLI: 1.5.0
Node: 9.0.0
OS: linux x64
Angular: 5.0.0
... common, compiler, compiler-cli, core, forms, http
... platform-browser, platform-browser-dynamic, router

@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.0
typescript: 2.4.2
webpack: 3.8.1
node: 9.0.0
npm: 5.5.1

Repro steps.

I just build a webpack program and I get this error with @ngtools

The log given by the failure.

ERROR in ./test/angular-webpack/angular/bundle.aot.ts
Module not found: Error: Can't resolve './module.ngfactory' in '/home/patrikx3/Projects/angular5/corifeus-web5/test/angular-webpack/angular'
 @ ./test/angular-webpack/angular/bundle.aot.ts 8:25-54

ERROR in Error: Please update @angular/cli. Angular 5+ requires at least Angular CLI 1.5+
  at throwNotSupportedError (/home/patrikx3/Projects/angular5/corifeus-builder-angular5/node_modules/@angular/compiler-cli/src/ngtools_api.js:78:11)
  at Function.NgTools_InternalApi_NG_2.codeGen (/home/patrikx3/Projects/angular5/corifeus-builder-angular5/node_modules/@angular/compiler-cli/src/ngtools_api.js:31:15)
  at _donePromise.Promise.resolve.then (/home/patrikx3/Projects/angular5/corifeus-builder-angular5/node_modules/@ngtools/webpack/src/plugin.js:430:58)
  at <anonymous>:null:null
  at process._tickCallback (internal/process/next_tick.js:188:7)
  at Function.Module.runMain (module.js:684:11)
  at startup (bootstrap_node.js:191:16)
  at bootstrap_node.js:613:3


ERROR in /home/patrikx3/Projects/angular5/corifeus-web5/test/angular-webpack/angular/bundle.aot.ts (8,31): Cannot find module './module.ngfactory'.

Desired functionality.

I am on Angular CLI 1.5, why do I get this error that I am not on Angular 1.5???

Mention any other details that might be useful.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19

Most upvoted comments

I faced this error after updating a non-CLI project to Angular 5 and @ngtools/webpack 1.8.0. I forgot to replace AotPlugin with AngularCompilerPlugin in my webpack config as described in the @ngtools/webpack README.md

By using AngularCompilerPlugin the error went away.

Yes, that’s it , now it works!, THANKS!

@about-code Thanks for the answer. I replaced two instances of AotPlugin to AngularCompilerPlugin, and it seems to solve the issue. Thx.

@about-code I too am using ASP.NET Core 2.0’s Angular template and upgraded from Angular 4 to Angular 5. I replaced two instances of AotPlugin in my wepack.config.js file with AngularCompilerPlugin to fix the problem. Thank you for pointing me in the right direction. I can’t recall where I got the link from now, but anyone looking to do the same can go (https://long2know.com/2017/11/angular-5-0-released/) to see how it is done.

@danielleiszen Do you have any link to that ASP.NET template, a repo or something alike? Your versions seem to be up-to-date.

Are @angular/cli AND @ngtools/webpack both a direct dependency of your project? Because if you use @angular/cli you usually don’t need to install @ngtools/webpack yourself since its part of @angular/cli. Having both might be a sign that you have a custom webpack build. Then you should also have a webpack config and may need to adjust the webpack config like I described earlier.