728x90

Problem

I am stuck in a loop where running npm run watch says it cannot find cross-spawn.

 

 

> @ watch /Users/donnie/Github/laravel_project
> npm run development -- --watch


> @ development /Users/donnie/Github/laravel_project
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"

module.js:549
    throw err;
    ^

Error: Cannot find module 'cross-spawn'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/donnie/.yarn-cache/npm-cross-env-5.2.0/dist/index.js:5:19)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
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 "--watch"`
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/donnie/.npm/_logs/2019-01-22T21_57_39_199Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `npm run development -- --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch 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/donnie/.npm/_logs/2019-01-22T21_57_39_227Z-debug.log

 

 

 

 

1 Answer

ActiveOldestVotes

5

Running npm rebuild then npm install should fix the problem. Now, running npm run dev should build fine.

I believe this issue has something to do with bad file permissions and npm rebuild seems to sort things out.

 

 

stackoverflow.com/questions/54328631/endless-loop-cannot-find-cross-spawn

+ Recent posts