Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Jiyaad's avatar

Unable to run npm run dev

Hi I am currently running laravel 5.4. i have node and npm installed on my windows machine I am trying to learn laravel mix but when i run the command npm run dev i receive the following error:

C:\wamp64\www\The-Hub>npm run dev

> @ dev C:\wamp64\www\The-Hub
node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

'node_modules' is not recognized as an internal or external command,
operable program or batch file.
events.js:160
     throw er; // Unhandled 'error' event
     ^

Error: spawn node_modules/webpack/bin/webpack.js ENOENT
   at notFoundError (C:\wamp64\www\The-Hub\node_modules\cross-spawn\lib\enoent.js:11:11)
   at verifyENOENT (C:\wamp64\www\The-Hub\node_modules\cross-spawn\lib\enoent.js:46:16)
   at ChildProcess.cp.emit (C:\wamp64\www\The-Hub\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: `node node_modules/cross-env/dist/bin/cross-env.js 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 'node node_modules/cross-env/dist/bin/cross-env.js 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!     node node_modules/cross-env/dist/bin/cross-env.js 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\Jiyaad Dolly\AppData\Roaming\npm-cache\_logs\2017-04-18T10_35_02_993Z-debug.log

I am not sure how to fix this error. i did some googling but could not find any solutions yet

0 likes
3 replies
samalapsy's avatar

Hi I am currently running laravel 5.4. i have node and npm installed on my windows machine I am trying to learn laravel mix but when i run the command npm run dev i receive the following error:

@JIYAAD you have to install node in your project

Navigate to your project root and run npm install to install node in your porject. Once it's done npm run dev would work

Hope it helps.

1 like
Jiyaad's avatar

Hi I ran the command npm install and recieve the following output:

C:\wamp64\www\The-Hub>npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

after that i ran the command npm run dev and recieve the follwoing output:

C:\wamp64\www\The-Hub>npm run dev

> @ dev C:\wamp64\www\The-Hub
> node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

'node_modules' is not recognized as an internal or external command,
operable program or batch file.
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules/webpack/bin/webpack.js ENOENT
    at notFoundError (C:\wamp64\www\The-Hub\node_modules\cross-spawn\lib\enoent.js:11:11)
    at verifyENOENT (C:\wamp64\www\The-Hub\node_modules\cross-spawn\lib\enoent.js:46:16)
    at ChildProcess.cp.emit (C:\wamp64\www\The-Hub\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: `node node_modules/cross-env/dist/bin/cross-env.js 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 'node node_modules/cross-env/dist/bin/cross-env.js 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!     node node_modules/cross-env/dist/bin/cross-env.js 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\Jiyaad Dolly\AppData\Roaming\npm-cache\_logs\2017-04-18T11_08_40_451Z-debug.log

C:\wamp64\www\The-Hub>

also if this helps this is my package.json file

{
  "private": true,
  "scripts": {
    "dev":        "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch":      "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "hot":        "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "production": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },
  "devDependencies": {
    "axios": "^0.15.3",
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^4.0.0",
    "jquery": "^3.1.1",
    "laravel-mix": "^0.8.1",
    "lodash": "^4.17.4",
    "vue": "^2.1.10"
  }
}
MaverickChan's avatar

1.download node.js from Official site , use version 6 , not 7 2.after install , reopen your terminal. 3.run npm install in your project folder 4.it should be fine.

oh , by the way , please download the latest package.json file. or install a brand new laravel project which contains it .

Please or to participate in this conversation.