The build command requires to be run in an Angular project, but a project definition could not be fo
程序员文章站
2022-04-28 13:25:44
...
报错:The build command requires to be run in an Angular project, but a project definition could not be found
本来是为了解决cli版本过低的问题,一下子从1.2.7升级到7.3.6,运行node --max-old-space-size=3000 \"node_modules/@angular/cli/bin/ng\" build --prod --aot,直接报错,原因是在新版本的@angular/cli,angular.json替代了angular-cli.json,所以它认为这不是一个angular项目!
解决方式:
ng update @angular/cli --migrate-only --from=1.7.3
报错:FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
ng build 编译没有问题,ng build --pord --aot 编译就报这个错
解决:node --max-old-space-size=3000 \"node_modules/@angular/cli/bin/ng\" build --pord --aot
主要是增加参数--max-old-space-size=3000,这个内存配置多大,试着看咯,单位是M
报错:
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in
解决:据说是angular/cli的版本过低,还没验证!