尝试构建角度构建时出现接收错误 [英] Receiving error while try to build Angular build
本文介绍了尝试构建角度构建时出现接收错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试为Production
构建我的Angular Application
。
当我尝试时
ng build --prod
我收到此错误
Option "--prod" is deprecated: Use "--configuration production" instead.
Option "extractCss" is deprecated: Deprecated since version 11.0. No longer required to disable CSS extraction for HMR.
⠋ Generating browser application bundles (phase: setup)...An unhandled exception occurred: ENOENT: no such file or directory, lstat '/Users/xxx/Documents/GitHub/spa/node_modules/primeng/resources/themes/nova-light'
See "/private/var/folders/ft/644bz6_17vj4yr0q_j3wxzdm0000gn/T/ng-wiA0sW/angular-errors.log" for further details.
之后,我尝试了
ng build -- --prod
我收到此错误
Unknown option: '--prod'
所以我又试了一次
npm run build -- --prod
我收到此错误
Option "--prod" is deprecated: Use "--configuration production" instead.
Option "extractCss" is deprecated: Deprecated since version 11.0. No longer required to disable CSS extraction for HMR.
⠋ Generating browser application bundles (phase: setup)...An unhandled exception occurred: ENOENT: no such file or directory, lstat '/Users/xx/Documents/GitHub/spa/node_modules/primeng/resources/themes/nova-light'
See "/private/var/folders/ft/644bz6_17vj4yr0q_j3wxzdm0000gn/T/ng-0IJZJW/angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! app@0.0.0 build: `ng build --prod "--prod"`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the app@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xx/.npm/_logs/2021-08-01T21_01_45_518Z-debug.log
推荐答案
我也偶然发现了这一点。如果你是纯粹的角度,那么
ng build --configuration production
如果您的项目具有像Azure Static Web Apps这样的ng+API节点后端,则
npm run build --configuration
注意:不要npm run build --configuration production
,否则会导致
NG Build--Prod&Quot;Products&Quot;出现未处理的异常:项目 "生产"不存在。
这篇关于尝试构建角度构建时出现接收错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文