NG构建--prod扔errr
我使用ng build --prod
命令却是露出像NG构建--prod扔errr
ERROR in ./src/main.ts Module not found: Error: Can't resolve './app/app.module.ngfactory' in 'C:\Users\allud\MyCafe\src'
resolve './app/app.module.ngfactory' in 'C:\Users\allud\MyCafe\src'
using description file: C:\Users\allud\MyCafe\package.json (relative path: ./src)
Field 'browser' doesn't contain a valid alias configuration
after using description file: C:\Users\allud\MyCafe\package.json (relative path: ./src)
using description file: C:\Users\allud\MyCafe\package.json (relative path: ./src/app/app.module.ngfactory)
no extension
Field 'browser' doesn't contain a valid alias configuration
C:\Users\allud\MyCafe\src\app\app.module.ngfactory doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
C:\Users\allud\MyCafe\src\app\app.module.ngfactory.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
C:\Users\allud\MyCafe\src\app\app.module.ngfactory.js doesn't exist
as directory
C:\Users\allud\MyCafe\src\app\app.module.ngfactory doesn't exist
[C:\Users\allud\MyCafe\src\app\app.module.ngfactory]
[C:\Users\allud\MyCafe\src\app\app.module.ngfactory.ts]
[C:\Users\allud\MyCafe\src\app\app.module.ngfactory.js]
[C:\Users\allud\MyCafe\src\app\app.module.ngfactory]
@ ./src/main.ts 3:0-66
@ multi ./src/main.ts
回答:
错误似乎线路节点缓存模块的问题。 请尝试以下给出命令:
cd {your-project} npm -f cache clean
rm -f package-lock.json
rm -rf node_modules
npm install
如果它不工作,你的清洁和.npm主目录中的.node-GYP。
回答:
有几件事情,你可以验证,
确定你是否在正确的目录加载组件,我指的是组件的
Import
声明import PackageName from './FromFolder';
删除路径node_modules并重新安装所有软件包
- 用更新的软件包更新您的Angular CLI版本
现在尝试ng build --prod
以上是 NG构建--prod扔errr 的全部内容, 来源链接: utcz.com/qa/261133.html