Vue-cli: ERROR while running task C:\Users\xxxxxx\GitHub\xxxx-app:serve with message'spawn vue-cli-service ENOENT'

Created on 7 Aug 2018  Â·  25Comments  Â·  Source: vuejs/vue-cli

Version

3.0.0-rc.10

Node and OS info

Windows 10 Enterprise / Node 8.9.1 / Yarn 1.7.0 / GitBash (MINGW64)

Steps to reproduce

  1. Run default "serve" task
  2. Stop default "serve" task

What is expected?

A clean shutdown of the task without error

What is actually happening?

ERROR while running task C:UsersxxxxGitHubxxxx-app:serve with message'spawn vue-cli-service ENOENT'

{ Error: spawn vue-cli-service ENOENT
at notFoundError (C:UsersxxxxAppDataLocalYarnDataglobalnode_modulescross-spawnlibenoent.js:6:26)
at verifyENOENT (C:UsersxxxxAppDataLocalYarnDataglobalnode_modulescross-spawnlibenoent.js:40:16)
at ChildProcess.cp.emit (C:UsersxxxxAppDataLocalYarnDataglobalnode_modulescross-spawnlibenoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn vue-cli-service',
path: 'vue-cli-service',
spawnargs: [ 'serve', '--mode', 'development', '--dashboard' ] }

Windows bug next ui

Most helpful comment

  1. delete "node_modules" folder
  2. run - npm install
    2019-03-06_9-41-42

All 25 comments

Are you using the UI?

Yes!

Creating a new Vue cli 3 project via commandline also crashes

Vue CLI v3.0.0-rc.10
✨ Creating project in /Users/raymond/stack/sites/xml.
🗃 Initializing git repository...
âš™ Installing CLI plugins. This might take a while...

npm ERR! code ETARGET
npm ERR! notarget No matching version found for @vue/cli-plugin-babel@^3.0.0-rc.11
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'xml'
npm ERR! notarget

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/raymond/.npm/_logs/2018-08-07T15_32_34_730Z-debug.log
ERROR command failed: npm install --loglevel error

@focussing Please create a new issue, yours is unrelated to this one.

Same is happening here. Using 3.0.0-rc.11. Stopping npm serve from the UI causes an error in the terminal.

Updated to 3.0.0 and this is still occurring.

w10 pro, node 10.5.0, vue/cli 3.0.0, vue ui.

Stopping server via ui also causes an error

  • in ui
    Error while running task C:\dev\testssr10:serve with message 'spawn vue-cli-service ENOENT'
  • in terminal
    { Error: spawn vue-cli-service ENOENT at notFoundError (C:\Users\germs\AppData\Roaming\npm\node_modules\@vue\cli\node_modu les\cross-spawn\lib\enoent.js:6:26) at verifyENOENT (C:\Users\germs\AppData\Roaming\npm\node_modules\@vue\cli\node_modul es\cross-spawn\lib\enoent.js:40:16) at ChildProcess.cp.emit (C:\Users\germs\AppData\Roaming\npm\node_modules\@vue\cli\no de_modules\cross-spawn\lib\enoent.js:27:25) at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12) code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn vue-cli-service', path: 'vue-cli-service', spawnargs: [ 'serve', '--mode', 'development', '--dashboard' ] }

win10, node 10.5.0, vue/cli 3.0.0, vue 2.5.17
vue ui:
Stopping server/build:
:serve/build with message 'spawn vue-cli-service ENOENT'

in terminal:
serve-->
{ Error: spawn vue-cli-service ENOENT at notFoundError (C:UsersdellAppDataLocalYarnDataglobalnode_modulesexecanode_modulescross-spawnlibenoent.js:6:26) at verifyENOENT (C:UsersdellAppDataLocalYarnDataglobalnode_modulesexecanode_modulescross-spawnlibenoent.js:40:16) at ChildProcess.cp.emit (C:UsersdellAppDataLocalYarnDataglobalnode_modulesexecanode_modulescross-spawnlibenoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn vue-cli-service',
path: 'vue-cli-service',
spawnargs: [ 'serve', '--mode', 'development', '--dashboard' ] }

build-->
{ Error: spawn vue-cli-service ENOENT at notFoundError (C:UsersdellAppDataLocalYarnDataglobalnode_modulesexecanode_modulescross-spawnlibenoent.js:6:26) at verifyENOENT (C:UsersdellAppDataLocalYarnDataglobalnode_modulesexecanode_modulescross-spawnlibenoent.js:40:16) at ChildProcess.cp.emit (C:UsersdellAppDataLocalYarnDataglobalnode_modulesexecanode_modulescross-spawnlibenoent.js:27:25) at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn vue-cli-service',
path: 'vue-cli-service',
spawnargs:
[ 'build', '--mode','production', '--dest', 'dist', '--target', 'app', '--dashboard' ] }

what should i do? it happen after i remove the register-server-worker.js and the relative files.

ping @Akryum

Same is happening with the last release.. need any log info or something to help you with?

Note: not happening to me on linux with node 10.8.0

Note happening on linux node 8.9.1 either, so looks like a Windows-related issue.

I did some research but still don't have any idea why node is throwing this ENOENT error when killing the process... It's not a critical issue anyway, since the processes seem to be correctly killed.

happend to me also, windows 10.

When i stop the serve task or when i try to build it... let me know if its helps to share something.

I'm getting the same issue but only when I run "npm run build" and I have a style (CSS) included in a component. It works fine without any styles in components.

Windows: 10
Node : 9.9.0
npm: 6.4.0
Vue: 2.5.17
VuuCLI: 3.0.0

Happens here as well, on Windows (10), and since it seemed to be a Windows issue (which indeed it is) I decided to take some time and investigate this, here's what I found:

Windows does not support sending signals, but Node.js offers some emulation with process.kill(), and subprocess.kill()

  • emulation which is incomplete, in the sense that if you process.kill() a child process spawned with child_process.spawn(), it will receive an exit event with code set to 1 and signal set to null
  • in other words, on Windows it's impossible to distinguish between a process that exited with an exit code of 1 and a process that was killed
  • interestingly enough, when using subprocess.kill() (instead of process.kill()) you get a correct exit event with code set to null and signal set to the signal used (i.e. SIGTERM, which is the signal used if not giving an argument to kill())
  • unfortunately subprocess.kill() has the drawback that, if the spawned child spawns in turn other sub-processes, those will not be killed and just be left hanging around when killing the child - that's the problem terminate is trying to solve
  • now, putting all the pieces together, what happens is this: vue-cli calls terminate(), which calls process.kill(), the child process receives an exit event with code set to 1, cross-spawn "hijacks" this event and in turn emits an error event, which vue-cli catches and shows the error.

Fixing this is not trivial, as we can't easily distinguish between this "false" ENOENT caused by Windows process behavior and a legitimate ENOENT - like when trying to execute a non-existing command or setting cwd to a non-existing folder (are there others?).

So what we could do:

  • in the process error handler check if we're on Windows (process.platform === 'win32') and if the error is ENOENT (error.code === 'ENOENT'), if yes then

    • check if the command's stderr contains 'foo' is not recognized as an internal or external command, operable program or batch file. (we'll have to collect stderr output to a local variable) and

    • check if cwd exists and it's a folder

    • if both are false it means we have a "false" ENOENT, so call the exit handler with code set to null.

It's ugly (and maybe misses some other ENOENT cases?), but I see no other way. If maintainers agree on this solution, I can create a PR.

check if the command's stderr contains 'foo' is not recognized as an internal or external command, operable program or batch file.

Except error messages are localized.

Might not be, I just tested on a Romanian localized Windows, and that error is still in English.

image

Yeah, sadly I get the same with French. Looks like they forgot to translate this to Romanian...

Ok, another option would be to look for the command in PATH, so that we're sure that it exists, and if we get a ENOENT it's not because the command doesn't exist.

Another approach would be to consider the command execution duration - if we're on Windows and we get a ENOENT after more than 1 second, it's most probably a "false" one (this will not cover the case where you press on start and immediately on stop; a workaround would be to disable the button for 1s after starting a task).

  1. delete "node_modules" folder
  2. run - npm install
    2019-03-06_9-41-42
Was this page helpful?
0 / 5 - 0 ratings