ng build --prod build failed after running npm ins

2019-04-10 12:03发布

Here is the error getting in prod build

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/var/www/project/src'
 @ ./src/main.ts 4:0-74
 @ multi ./src/main.ts

Getting error because new versions of packages being installed after running npm install. Cannot share packages version differences because the list is too lengthy. Its working with aot false but don't want to build with aot false. Not able to find out which package is responsible for this.

2条回答
Fickle 薄情
2楼-- · 2019-04-10 12:37

Try

npm i enhanced-resolve@3.3.0

or add it to your shrinkwrap.json or package-lock.json or yarn.lock or update angular-cli as said Filipe Silva

We've released 1.2.4/1.3.0-rc.1 to fix this issue

I also had issue with enhanced-resolve: angular-cli didn't respect my --environment flag

See also this thread

查看更多
乱世女痞
3楼-- · 2019-04-10 12:40
  1. npm clean cache
  2. Delete node_modules
  3. Add "enhanced-resolve": "3.3.0" in your package.json
  4. run npm install
  5. rebuild !

I solved it with this thread

https://github.com/angular/angular-cli/issues/7113

查看更多
登录 后发表回答