I'm trying to run
npm run dev for Laravel Mix and I get this error:
> @ dev D:\projects\ptcs > cross-env NODE_ENV=development webpack --progress --hide-modules -- config=node_modules/laravel-mix/setup/webpack.config.js 'cross-env' is not recognized as an internal or external command, operable program or batch file. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ dev: `cross-env NODE_ENV=development webpack --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.
I updated node.js to 6.11.0 and npm to 5.2.0, but it didn't help. I'm running Homestead on Windows 7.
This question is tagged with
~ Asked on 2017-07-11 12:25:05
You need to make cross-env working globally instead of having it in the project.
npm install --global cross-env
"cross-env": "^5.0.1", from
devDependencies section. Actually, you can skip this step and keep package.json intact. If you prefer.
npm install --no-bin-links
npm run dev
and see it working
P.S Tested on Windows 10 with Laravel-5.4
P.P.S Windows 10 with Laravel-5.6 does not have this problem, thus updating is an alternative solution.
~ Answered on 2017-08-11 07:28:18
rm -rf node_modules rm package-lock.json yarn.lock npm cache clear --force
Then run the command
npm install cross-env npm install
and then you can also run
npm run dev
~ Answered on 2018-04-07 14:45:04