Angular NPM Run Prod: Error npm ERR! missing script: prod

Viewed 2631

I am running npm with a new Angular Project and receiving error below. How can fix this?

npm ERR! missing script: prod
npm ERR! A complete log of this run can be found in:
npm ERR! C:\..2020-11-19T05_27_19_941Z-debug.log

Error preview

2 Answers

This is because you don't have the script : prod in your package.json file. If you want to run the angular project, you can use ng serve or npm run start

This means you don't have a configuration for prod in your scripts. Basically to run any angular project you need to make sure the scripts or commands are defined inside your package.json. Most angular projects will have a script configuration like below

"scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },

So, you can run either ng serve or npm start in your command to start the application.

Related