Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm run does nothing

Tags:

I've been working with Node.js/npm for a while, but I never used npm scripts. I was quite surprised to find that I can't get them to work at all on my Windows/Cygwin system. With a package.json like this ...

{   "name": "demo",   "scripts": {     "env": "env",     "hello": "echo Hello!",     "crap": "I am complete nonsense."   } } 

... all three npm run commands do nothing. npm run crap executes and returns immediately with an OK status (I tested with the -dd parameter); npm run doesntexist throws the expected error. Testing without Cygwin on the regular Windows shell made no difference.

like image 367
wortwart Avatar asked Aug 08 '16 20:08

wortwart


People also ask

Why npm run start not working?

Check the ignore-script config If you see the start script is present inside your package. json file but still can't run the script, you need to check the console output. If there's no output at all, then you may have the ignore-scripts npm configuration set to true .

What is npm Run command?

npm run sets the NODE environment variable to the node executable with which npm is executed. If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install , just in case you've forgotten.


1 Answers

I finally found out myself. There is an npm setting with which you can stop all npm scripts from running. For some reason, my userconfig file ~/.npmrc contained the setting ignore-scripts = true. If you run into this problem, check npm config list.

like image 60
wortwart Avatar answered Sep 27 '22 20:09

wortwart