3.5.3
https://github.com/PanJiaChen/vue-element-admin
Win10 Sub Linux ( Ubuntu )
yarn install
./node_modules/.bin/vue-cli-service serve
without error
$ ./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)
Info: WSL 琚敊褰撴垚 Windows
WSL Mistaken for Windows
Is your WSL environment based on Debian? I鈥檝e noticed some strange behaviours with npm in Debian Buster that I鈥檝e 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鈥檝e got when I executed vue create foo.
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.
Disable browser auto-opening by edit vue.config.js,
module.exports = {
//...
devServer: {
open: false
}
};
see also https://webpack.js.org/configuration/dev-server/#devserveropen
Most helpful comment
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/System32to your path before running the command.e.g.:
or
The former command will not alter your current shell while the latter will, so choose the one that suits your needs best.