Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve npm run dev missing script issues?

I am currently in the folder 'C:\Users\vignesh\Documents\Personal Projects\Full-Stack-Web-Developement' on gitbash

npm run dev

executing the above command on gitbash gives me the following error. I am assuming this is due to the NODE_PATH variables not being set properly. Please let me know if anyone has a solution to the below problem

npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev" npm ERR! node v4.4.6 npm ERR! npm  v2.15.5  npm ERR! missing script: dev 
like image 769
user3804335 Avatar asked Dec 13 '16 20:12

user3804335


People also ask

Where are npm run scripts?

Scripts are run from the root of the package folder, regardless of what the current working directory is when npm run is called.

What does npm err missing script start mean?

The npm error missing script: “start” means that npm can't execute the “start” script from your package. json file. This error happens when you run the npm start or npm run start command from the command line.

What is npm run dev command?

The npm run dev command is a generic npm command that you can find in many modern web application projects. This command is used to run the dev script defined in the project's package. json file.


2 Answers

npm run <command> 

will run bash script from package.json from 'scripts' value of '' attribute. For example:

package.json

{    "name": "app",    "version": "0.0.0",    "license": "MIT",    "scripts": {       "server": "webpack-dashboard -- webpack-dev-server --inline --port 8080",       "webdriver-update": "webdriver-manager update",    },   "dependencies": {    "@angular/common": "~2.2.0",    "@angular/core": "~2.2.0"    },   "devDependencies": {    "@types/core-js": "^0.9.0"    } } 

In this case you can run scripts:

npm run server npm run webdriver-update 

In your case you probably wont have dev script.

Remember that few scripts name are reserved (for example npm test will try to run, npm run pretest, npm run test, npm run posttest). More info on https://docs.npmjs.com/misc/scripts

like image 186
Michał Ignaszewski Avatar answered Sep 19 '22 05:09

Michał Ignaszewski


Simply check the package.json file and see what the name of the key is for dev. In my case it was start instead of dev, so I ran npm run start and that did it.

Screenshot:

Screenshot

like image 31
Zoh_Akh Avatar answered Sep 19 '22 05:09

Zoh_Akh