question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm run dev (the same with other commands) fail in Windows 10 subsystem bash.

See original GitHub issue
  • Laravel Version: 5.4.6
  • PHP Version:7.1.1
  • Database Driver & Version:MySQL 5.7
  • Windows 10 V1607 with latest updates.
  • Windows Subsystem Bash Ubuntu 14.04.
  • Laravel-mix 0.5.16

Description:

After upgrade to 5.4.6, fresh install project in windows 10 and with node 7.4 works fine. But npm in windows 10 subsystem bash fail with “95% emitting ERROR Failed to compile with 3 errors”

Steps To Reproduce:

  1. Node 7.4 and npm 4.1.2 in windows 10 subsystem bash.
  2. fresh install laravel 5.4.6.(in bash)
  3. npm install.(in bash)
  4. npm run production.(in bash)
npm ERR! Linux 3.4.0+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "production"
npm ERR! node v7.4.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! @ production: `node node_modules/cross-env/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`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ production script 'node node_modules/cross-env/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'.
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/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
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! Please include the following file with any support request:
npm ERR!     /mnt/c/Users/alexe/PhpstormProjects/fabtek/npm-debug.log

Also upload the log in detail. npm-debug.txt

There was a same issue opened in https://github.com/laravel/framework/issues/17620

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
Yuant-tobingcommented, Feb 26, 2017

If you get an error message when you run the command : npm install or npm run dev on laravel v5.4.* project. *, please follow the steps below :

make sure your nodejs version v6. * and npm v4. *

1 command: $ npm rebuild 2 commands: $ npm install {not excluding --no-bin-link} 3 command: $ npm run dev

everything will go well and I have tried on laravel v.5.4 project. I hope, this solution can help you and others.

2reactions
acornx9commented, Mar 21, 2017

@mostafa6765: I had the same problems on Windows 10 with Laragon. The path in your packages.json is wrong for cross-env.js. The paths for the npm commands are like this:

dev": "node node_modules/cross-env/bin/cross-env.js…

BUT cross-env is actually in node_modules/cross-env/dist/bin/

Edit your packages.json so it looks like the screenshot I’ve include and try again. It works fine after you have fixed your paths.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm run dev (the same with other commands) fail in Windows ...
This is because npm is trying to run node , which is not a command in Ubuntu (Windows Bash) until you make it....
Read more >
npm commands not working on Bash on Ubuntu on Windows ...
1 ➜ ~ sudo find / -name npm /home/damo/.npm/10.52.63.39_4783/npm /home/damo/.npm/npm /home/damo/.nvm/versions/node/v10 ...
Read more >
Set up Node.js on WSL 2 - Windows - Microsoft Learn
Install Node.js on Windows Subsystem for Linux (WSL2) ... slightly different commands and is installed via npm rather than a bash script.
Read more >
Integrated Terminal in Visual Studio Code
The integrated terminal can run commands such as mkdir and git just like a standalone terminal. Note: Open an external terminal with the...
Read more >
command not found" errors running Bash scripts in WSL?
But I'm blocked at the latest steps. It's where I trying to download or train the model in Windows. Using for example the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found