Istiak Mahmood
Istiak Mahmood

Reputation: 2422

Receiving error while try to build Angular build

I am trying to build my Angular Application for Production.

When I try

ng build --prod

I receive this error

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.

After that, I have tried

ng build -- --prod

And I am receiving this error

Unknown option: '--prod'

So I tried again

npm run build -- --prod

And I am receiving this error

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! [email protected] build: `ng build --prod "--prod"`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] 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

Upvotes: 1

Views: 1619

Answers (1)

Jeb50
Jeb50

Reputation: 7037

I stumbled on this as well. If you're purely on Angular, then

ng build --configuration production

If you project has ng + API node backend like Azure Static Web Apps, then

npm run build --configuration

Note: don't do npm run build --configuration production, it results

ng build --prod "production" An unhandled exception occurred: Project 'production' does not exist.

Upvotes: 1

Related Questions