laravel-mix: npm run dev fails on my 5.4 when configuring passport API Authentication

$ npm run dev

@ dev C:\xampp\htdocs\TocApp cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

The system cannot find the path specified. events.js:160 throw er; // Unhandled ‘error’ event ^

Error: spawn node_modules/webpack/bin/webpack.js ENOENT at notFoundError (C:\xampp\htdocs\TocApp\node_modules\cross-spawn\lib\enoent.js:11:11) at verifyENOENT (C:\xampp\htdocs\TocApp\node_modules\cross-spawn\lib\enoent.js:46:16) at ChildProcess.cp.emit (C:\xampp\htdocs\TocApp\node_modules\cross-spawn\lib\enoent.js:33:19) at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) npm ERR! code ELIFECYCLE npm ERR! errno 1 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! Exit status 1 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.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\BRAYAN\AppData\Roaming\npm-cache_logs\2017-03-27T08_28_13_634Z-debug.log

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (4 by maintainers)

Most upvoted comments

I had this issue i did the following steps and i have no issues anymore:

  1. Delete node_modules directory
  2. Detete package-lock.json file -> very important
  3. Run npm install
  4. Run npm run dev

My details:

npm -v => 5.0.3 node -v => v8.1.4

"laravel-mix": "^1.2.1", "cross-env": "^5.0.1", "vue": "^2.4.1",

i did a fresh installation of laravel updated my node and npm and all worked fine,followed these steps

run composer install;
run npm install;
run npm install cross-env -D (read it from laravel/framework#18446);
run npm run dev.

I had this issue i did the following steps and i have no issues anymore:

  1. Delete node_modules directory
  2. Detete package-lock.json file -> very important
  3. Run npm install
  4. Run npm run dev

My details:

npm -v => 5.0.3 node -v => v8.1.4

"laravel-mix": "^1.2.1", "cross-env": "^5.0.1", "vue": "^2.4.1",

Cheers mate, that worked

You probably need node 8 for some of these new loaders to work.

@hassanazimi sol’n worked for me. thanks, mate.

@dk4210 Then use Gulp. Or, create a new issue and explain what specifically you’re having trouble with. It’s almost always related to a faulty install.

Tried @Brayantezz method but didn’t worked. I fixed it by requiring webpack in my local package.json file. Even though I had it installed globally.

Thanks, it works!. @Brayantezz