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

lloy0076's avatar

NPM Run Dev on Windows

It appears that Laravel 5.4 is moving away form "gulp" and using a somewhat more pure "webpack" workflow.

HOWEVER it appears that the "dev" script for "npm run dev" assumes that anything ending in ".js" is runnable, specifically:

λ npm run dev

> @ dev c:\laragon\www\playground
> node_modules/cross-env/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.

To fix this I simply did:

λ node node_modules/cross-env/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

...instead.

SIMPLY PUT:

Bug Appeared on: Windows (I happen to have Windows 10)
Happened in: Laragon environment (http://laragon.org - I'm on 2.1.16)
But is NOT related to Laragon: This seems to be because windows doesn't recognise ".js" files as executable [which is sort of fair enough].
Reproduce: Install Laragon or some sort of WAMP server, install Laravel and then run 'npm install' (or yarn install - whatever is your choice) and then try 'npm run dev'
Expection: webpack runs smoothly without a problem
Fix: See above.
0 likes
4 replies
Serkan's avatar

i got this errors. can anybody help me?

PS W:\portal54> npm run dev

portal54@1.0.0 dev W:\portal54 node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hid e-modules --config=node_modules/laravel-mix/setup/webpack.config.js

module.js:472 throw err; ^

Error: Cannot find module 'W:\portal54\node_modules\laravel-mix\setup\webpack.config.js' at Function.Module._resolveFilename (module.js:470:15) at Function.Module._load (module.js:418:25) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at requireConfig (W:\portal54\node_modules\webpack\bin\convert-argv.js:96:18) at W:\portal54\node_modules\webpack\bin\convert-argv.js:109:17 at Array.forEach (native) at module.exports (W:\portal54\node_modules\webpack\bin\convert-argv.js:107:15) at Object. (W:\portal54\node_modules\webpack\bin\webpack.js:153:40) at Module._compile (module.js:571:32)

npm ERR! Windows_NT 10.0.14393 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run " "dev" npm ERR! node v7.4.0 npm ERR! npm v4.0.5 npm ERR! code ELIFECYCLE npm ERR! portal54@1.0.0 dev: node node_modules/cross-env/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 portal54@1.0.0 dev script 'node node_modules/cross-env/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 portal54 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/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --pro gress --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 portal54 npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls portal54 npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! W:\portal54\npm-debug.log

Serkan's avatar

i could install on mac clearly but windows didn't

Frondor's avatar

I was afraid of this happening when I heard the news... Fuck iOS users, always screwing up window's development.

That fix is not working by the way, I get

> @ dev c:\wamp\www\web
> node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.co
nfig.js

path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^
1 like
lloy0076's avatar

I'm running mine in a "cmder" window with all of the "git bash" tools in my path - it's possible I have a setup that's a little more "unix-like" even though I'm Windows.

1 like

Please or to participate in this conversation.