laravel-mix: 'node_modules' is not recognized as an internal or external command
After npm install and npm run dev, console show:
@ dev C:\Users\lukas\apps
node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
‘node_modules’ is not recognized as an internal or external command, operable program or batch file.
npm ERR! Windows_NT 10.0.15014
npm ERR! argv “C:\NodeJS\node.exe” “C:\NodeJS\node_modules\npm\bin\npm-cli.js” “run” “dev”
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ dev: node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script ‘node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js’.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 30 (3 by maintainers)
add
node ./in each line, so they look like this:I had the same issue. I just had to modify every instance of “node_modules/cross-env/bin/cross-env.js” with just “cross-env”
Doesn’t work for me.
node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.jsright in console works perfectly.node v7.4.0 npm v4.0.5 npm-debug.txt
Windows 7 64-bit, NodeJS 6.9.4, npm 4.1.1.
Adding
nodein front of the script commands worked here. I use GitBash that came with Git.Any ideas if this change then later on works normally on a non-Windows system?
Resolved by updating package.json, and reinstalling node-sass manully.
followed by
working correctly now.
Install cross-dev globally with
npm install -g cross-devand modify package.json by placingnodein front of each executed Javascript.For example, my package.json now looks like this:
We updated the Laravel repo to add “node” to the beginning of each NPM script.
@GDanielRG You have something unrelated to this issue. You can file a new one if it’s still not working after checking your Node/NPM versions and redoing npm install.