ng serve api --prod
Error:
Configuration 'production' could not be found in project 'api'.
Error: Configuration 'production' could not be found in project 'api'.
at Architect.getBuilderConfiguration (/Developer/Work/SPA/ngx-starter-kit/node_modules/@angular-devkit/architect/src/architect.js:106:23)
at ServeCommand.runSingleTarget (/Developer/Work/SPA/ngx-starter-kit/node_modules/@angular/cli/models/architect-command.js:103:45)
at ServeCommand.runArchitectTarget (/Developer/Work/SPA/ngx-starter-kit/node_modules/@angular/cli/models/architect-command.js:127:35)
at ServeCommand.run (/Developer/Work/SPA/ngx-starter-kit/node_modules/@angular/cli/commands/serve-impl.js:24:21)
at ServeCommand.validateAndRun (/Developer/Work/SPA/ngx-starter-kit/node_modules/@angular/cli/models/command.js:123:31)
at process._tickCallback (internal/process/next_tick.js:43:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:763:11)
at startup (internal/bootstrap/node.js:308:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3)
Source Project:
https://github.com/xmlking/ngx-starter-kit
You should not use ng serve --prod in actual production!
But for checking locally, you can add a production environment to the project config in angular.json.
"production": {
"buildTarget": "api:build"
}
If you are running in production you may want to seek out ways to properly run a node process in production such as PM2.
thanks @FrozenPandaz got it working with following config.
yes, my intention is to test app with environment.prod.ts config.
"serve": {
"builder": "@nrwl/builders:node-execute",
"options": {
"buildTarget": "api:build"
},
"configurations": {
"production": {
"buildTarget": "api:build:production"
}
}
},