"npm-run-all" Is Not Recognized As an Internal or External Command
Andrew Mclaughlin
I installed npm-run-all and also configured the environment variable (which may or may not be not required) on my Windows machine but am getting an error:
'npm-run-all' is not recognized as an internal or external command, operable program or batch file
I am trying to build my current project with npm run build which includes the script where the error is thrown:
npm-run-all -p build-css build-webpackDo I have to do any additional things to make it run?
29 Answers
- Make sure the
npm-run-allis in your package.jsondevDependencies. - If
npm-run-allis present in your package.json, runnpm i - If not present install it, run:
npm i npm-run-all -D
If error is still present, follow these steps:
- Remove node_modules folder: run
rm -rf node_modules - Install all dependecies: run
npm i
Hope this helps!
1You may just need to run the following command first (from the directory with the package.json file)
npm install You have a couple of options here, besides installing npm-run-all as a global package as suggested by @Vaibhav in the comments:
1) Create an NPM script
The package.json file has a scripts section which can used to define shortcuts for anything you need to run while you're working on your app. There are some pre-defined scripts, like run or test than can be executed with simply npm start/npm test or you can define anything you like and then run it with npm run my-script-name. You could try:
{ "scripts": { "start": "npm-run-all -p build-css build-webpack" }
}Any NPM module referenced here "just works" (i.e. the path to the executable is resolved under the hood by NPM)
2) NPX
In newer versions of NPM (i.e. >= 5.2 or so), the "NPX" executable is provided. This has a similar effect to running commands inside an NPM script. You would run:
npx npm-run-all -p build-css build-webpackAgain, the path would be automatically resolved.
If you have an older NPM install, you can also install it separately:
npm install -g npx 2 Please do that like this.
npm i npm-run-all -gAnd then this issue will be fixed.
npm install -g npm-run-all
Works for me.
Double check if npm-run-all is in your package.json devDependencies.
I had same problem while using code editor Brackets.
To resolve the error, I did the following steps.
Add nodejs new system variable to your PC under Control Panel -> System -> Advanced System Settings
;C:\Program Files\nodejs\After that, re-run command:
npm I don't know if this would help anyone, but I got this error because I was doing nodemon server.js instead of nodemon server/server.js. I wasn't in the right folder!
Did you reopen the terminal after you installed node?
If you have installed npm with the current terminal window open. Your terminal window will not have loaded the latest path settings (with npm location) to find the npm application to run the command. In this case try below steps .
- Try closing the current terminal session.
- Reopen a new session.
- Try the command again ( will pick up the new path settings with npm installed)
This worked for me.
npm audit fix --forceAlso you can try downgrading your autoprefixer, seems version 10.0.0 doesn't work well with postcss
npm i autoprefixer@9.8.6