8

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.

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

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

The error I always get when I ran npm run dev :

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!     /Users/baloghdominik/.npm/_logs/2020-02-26T17_05_54_290Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ dev 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!     /Users/baloghdominik/.npm/_logs/2020-02-26T17_05_54_315Z-debug.log
1
  • 2
    show us your package.json content. node version npm version could be usefull too Feb 26, 2020 at 17:22

5 Answers 5

17

First run

npm install cross-env

npm install 

Then run

npm run dev
3
  • 1
    That will not work as this is cache problem . Apr 9, 2021 at 14:48
  • please select this answer if its help for you thank you. @Dominik Balogh Jun 19, 2021 at 12:03
  • works fine, thanks
    – ynsmtkl
    Sep 20, 2021 at 20:57
6

Simple steps :

  1. npm cache clear --force
  2. delete node_modules and package-lock.json
  3. npm install
  4. npm run dev
5
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install

Basically delete the node_modules folder and package-lock.json file , clear cache and do an npm install. Worked for me.

0

In my case I had old version of node.js so I just installed version I need:

sudo npm install n -g

sudo n stable

Or can try use latest:

sudo n latest

0

If u using nvm, u need use version for project. Commands helped for me:

  1. Use default version node: nvm use system
  2. Remove node_modules rm -rf node_modules and rm -f package-lock.json
  3. Clear cache npm cache clear --force
  4. Finished command npm i

Not the answer you're looking for? Browse other questions tagged or ask your own question.