'cross-env' is not recognized as an internal or external command,

Jesray Garciano picture Jesray Garciano · Feb 17, 2018 · Viewed 29.2k times · Source

Guys can you please help me on this I have trouble run npm run dev for my Laravel Mix. I followed links below but still error exist. Do i have a problem on my OS? I tried to remove node_modules, run npm install --global cross-env. and run NPM install again.

https://github.com/JeffreyWay/laravel-mix/issues/478

Laravel 5.4 'cross-env' is not recognized as an internal or external command

Here are my versions:

  • Laravel mix version: ^2.0
  • Node Version (node -v): 8.9.0
  • NPM Version (npm -v): 5.6.0
  • OS: Windows7
  • XAMPP
> @ development C:\xampp\htdocs\codetinerant
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --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! @ development: `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! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Garciano\AppData\Roaming\npm-cache\_logs\2018-02-17T10_08_34_901Z-debug.log

Answer

flik picture flik · Apr 8, 2018

First, run:

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