framework: 'npm run dev' doesn't do anything (Windows 10)
- Laravel Version: 5.4.16
- PHP Version: 7.1.2-3+deb.sury.org~xenial+1 (Homestead)
- Database Driver & Version:
Description:
Running on windows 10, new install of node, homestead and laravel, completely new project with ‘laravel new project-name’. Laravel’s running smoothly but I can’t seem to get app.scss to build by using ‘npm run dev’ in homestead ssh gives me the following error:
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
sh: 1: cross-env: not found
npm ERR! Linux 4.4.0-51-generic npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” “run” “dev” npm ERR! node v6.10.0 npm ERR! npm v3.10.10 npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! @ dev:
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the @ dev script ‘cross-env 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! cross-env 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.
So I added node node_modules/ to the dev script in packages.json, like so:
“dev”: “node node_modules/cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js”
Now the command executed without any problems, however my app.css is not updated with the changes from app.scss. Here’s hoping someone knows the solution to this or what I’m doing wrong?
Steps To Reproduce:
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 21 (10 by maintainers)
Other option is to just
Edit package.json and replace
cross-env [...]
withnode node_modules/cross-env/dist/bin/cross-env.js [...]
Everyone - if you’re getting “cross-env” not found, do
npm install cross-env -D
, and then make sure that you update your npm scripts in package.json to referencecross-env
, rather than the full node_modules path to cross-env.I have a windows computer at the office and this finally worked for me.
Hope this helps someone using Windows 10 and the newest homestead vm:
replace package.json scripts to this:
then:
Should be good to go so try:
yarn run dev
Remove the
node_modules
that you put in the script and donpm install --save-dev cross-env
and then try.