Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WSL] Error: spawn cmd.exe ENOENT #4125

Closed
marxangels opened this issue Jun 9, 2019 · 4 comments
Closed

[WSL] Error: spawn cmd.exe ENOENT #4125

marxangels opened this issue Jun 9, 2019 · 4 comments
Labels
needs team repro We acknowledged your report and will soon try to reproduce it

Comments

@marxangels
Copy link

marxangels commented Jun 9, 2019

Version

3.5.3

Reproduction link

https://github.com/PanJiaChen/vue-element-admin

Environment info

Win10 Sub Linux ( Ubuntu )

Steps to reproduce

yarn install

./node_modules/.bin/vue-cli-service serve

What is expected?

without error

What is actually happening?

$ ./node_modules/.bin/vue-cli-service serve

events.js:183
throw er; // Unhandled 'error' event
^

Error: spawn cmd.exe ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

@marxangels
Copy link
Author

Info: WSL 被错当成 Windows

WSL Mistaken for Windows

@haoqunjiang haoqunjiang added the needs team repro We acknowledged your report and will soon try to reproduce it label Jun 13, 2019
@kmohrf
Copy link

kmohrf commented Jul 25, 2019

Is your WSL environment based on Debian? I’ve noticed some strange behaviours with npm in Debian Buster that I’ve not been able to reproduce with the official nodejs binaries and updated versions of npm (node is v10.15.2 and npm 5.8.0 in Debian Buster). Among those were hanging npm ci commands in GitLab runners with docker and the yarn error you’ve got when I executed vue create foo.

@drwatsoncode
Copy link

I think this error is related to this create-react-app issue which is caused by the way the browser is launched in WSL (using cmd.exe which is not in the PATH). The root problem may be in the opn aka open npm package.

A workaround is to add /mnt/c/Windows/System32 to your path before running the command.

e.g.:

PATH="$PATH:/mnt/c/Windows/System32"   /node_modules/.bin/vue-cli-service serve

or

export PATH="$PATH:/mnt/c/Windows/System32"
/node_modules/.bin/vue-cli-service serve

The former command will not alter your current shell while the latter will, so choose the one that suits your needs best.

@marxangels
Copy link
Author

marxangels commented Nov 22, 2020

Disable browser auto-opening by edit vue.config.js,

module.exports = {
  //...
  devServer: {
    open: false
  }
};

see also https://webpack.js.org/configuration/dev-server/#devserveropen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs team repro We acknowledged your report and will soon try to reproduce it
Projects
None yet
Development

No branches or pull requests

4 participants