Vue-cli: npm ERR! code ELIFECYCLE in using NPM RUN SERVE in running PWA Vue.JS 3 Template App on Mac

Created on 25 Sep 2018  路  38Comments  路  Source: vuejs/vue-cli

Version

3.0.3

Node and OS info

Node: v8.12.0, NPM: 6.4.1

Steps to reproduce

I'm having an error while running the newly created pwa template from Vue.JS 3.

The command that I'm using is npm run serve

What is expected?

I'm expecting to run my pwa template.

What is actually happening?

Having error that says

The error says,

npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! [email protected] serve: vue-cli-service serve
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the [email protected] serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /var/root/.npm/_logs/2018-09-25T07_17_36_807Z-debug.log


Here's the full log from 2018-09-25T07_17_36_807Z-debug.log file

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'serve' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle [email protected]~preserve: [email protected]
6 info lifecycle [email protected]~serve: [email protected]
7 verbose lifecycle [email protected]~serve: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~serve: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/myuser/Documents/AppFolder$
9 verbose lifecycle [email protected]~serve: CWD: /Users/myser/Documents/AppFolder/mywebapp
10 silly lifecycle [email protected]~serve: Args: [ '-c', 'vue-cli-service serve' ]
11 silly lifecycle [email protected]~serve: Returned: code: 126 signal: null
12 info lifecycle [email protected]~serve: Failed to exec serve script
13 verbose stack Error: [email protected] serve: vue-cli-service serve
13 verbose stack Exit status 126
13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:915:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/myuser/Documents/AppFolder/mywebapp
16 verbose Darwin 17.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "serve"
18 verbose node v8.12.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 126
22 error [email protected] serve: vue-cli-service serve
22 error Exit status 126
23 error Failed at the [email protected] serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]

needs reproduction

Most helpful comment

rm -rf node_modules/
npm install

All 38 comments

created pwa template from Vue.JS 3.

I assume that means you chose to install the PWA plugin during project creation? What other options did you choose?

You don't provide any details that would allow us to reproduce your scenario.

I am running into similar problems. I can run the build script, but the serve script is malfunctioning.

I created a test project using the default presets, and runs npm run serve immediately after creating the project.
Log here:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'serve' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle [email protected]~preserve: [email protected]
6 info lifecycle [email protected]~serve: [email protected]
7 verbose lifecycle [email protected]~serve: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~serve: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/michael/projects/test/node_modules/.bin:/home/michael/miniconda3/bin:/home/michael/dotfiles/scripts:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
9 verbose lifecycle [email protected]~serve: CWD: /home/michael/projects/test
10 silly lifecycle [email protected]~serve: Args: [ '-c', 'vue-cli-service serve' ]
11 silly lifecycle [email protected]~serve: Returned: code: 1  signal: null
12 info lifecycle [email protected]~serve: Failed to exec serve script
13 verbose stack Error: [email protected] serve: `vue-cli-service serve`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/michael/projects/test
16 verbose Linux 4.14.71-1-MANJARO
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "serve"
18 verbose node v10.10.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] serve: `vue-cli-service serve`
22 error Exit status 1
23 error Failed at the [email protected] serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

It seems that EventEmitter is running into some issues. This is probably caused by some upstream changes, since I was able to run the script fine a week or so earlier, and I probably updated something in the mean time.

Yes, @LinusBorg I included the pwa template during the project creation.

So, the problem mysteriously solves itself for me. @deanilvincent Try running npm run serve again. It's probably an upstream issue that is solved now.

Honestly, I've tried it so many times but still, the error persists. I've tried to clean the npm cache, delete node_modules folder then do some package restoration but nothing works.

Maybe a permission issue. Try sudo?

@sodatea Yup, I already tried it using sudo before posting this question. :(

Same problem here. I saw the issue is an error ENOSPC. Searching on stackoverflow I found this

https://stackoverflow.com/questions/22475849/node-js-error-enospc

that seems to fix the problem.

@deanilvincent Does @ardf69 's tip help?

Closing due to inactivity for more than 1 week. Please open a new issue with a reference to this one if you can follow up with more information.

hello , did you fix this problem? i am in the same position now. please help

npm install [email protected]

rm -rf node_modules/
npm install

Same issue here.

I was a same problem , I wait a little time and without do anything, after that, and sorprise, it working, but i don know the reason :''c

same issue here.
anybody solve this problem?

Same issue here! :|

Same issue.

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'serve' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle <project_name>@0.1.0~preserve: <project_name>@0.1.0
6 info lifecycle <project_name>@0.1.0~serve: <project_name>@0.1.0
7 verbose lifecycle <project_name>@0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle <project_name>@0.1.0~serve: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/<path_to_project>/<project_name>/node_modules/.bin:/home/vagrant/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle <project_name>@0.1.0~serve: CWD: /<path_to_project>/<project_name>
10 silly lifecycle <project_name>@0.1.0~serve: Args: [ '-c', 'vue-cli-service serve' ]
11 silly lifecycle <project_name>@0.1.0~serve: Returned: code: 1  signal: null
12 info lifecycle <project_name>@0.1.0~serve: Failed to exec serve script
13 verbose stack Error: <project_name>@0.1.0 serve: `vue-cli-service serve`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:970:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid <project_name>@0.1.0
15 verbose cwd /<path_to_project>/<project_name>
16 verbose Linux 4.15.0-47-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "serve"
18 verbose node v10.15.3
19 verbose npm  v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error <project_name>@0.1.0 serve: `vue-cli-service serve`
22 error Exit status 1
23 error Failed at the <project_name>@0.1.0 serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Can anyone fixed it? I'm also see same problem?
0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dev' ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'predev', 'dev', 'postdev' ] 5 info lifecycle [email protected]~predev: [email protected] 6 info lifecycle [email protected]~dev: [email protected] 7 verbose lifecycle [email protected]~dev: unsafe-perm in lifecycle true 8 verbose lifecycle [email protected]~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/mac/Documents/code/admin_navihome/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands 9 verbose lifecycle [email protected]~dev: CWD: /Users/mac/Documents/code/admin_navihome 10 silly lifecycle [email protected]~dev: Args: [ '-c', 10 silly lifecycle 'webpack-dev-server --inline --progress --config build/webpack.dev.conf.js' ] 11 silly lifecycle [email protected]~dev: Returned: code: 1 signal: null 12 info lifecycle [email protected]~dev: Failed to exec dev script 13 verbose stack Error: [email protected] dev:webpack-dev-server --inline --progress --config build/webpack.dev.conf.js 13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16) 13 verbose stack at EventEmitter.emit (events.js:189:13) 13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:189:13) 13 verbose stack at maybeClose (internal/child_process.js:970:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) 14 verbose pkgid [email protected] 15 verbose cwd /Users/mac/Documents/code/admin_navihome 16 verbose Darwin 18.5.0 17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev" 18 verbose node v10.15.3 19 verbose npm v6.9.0 20 error code ELIFECYCLE 21 error errno 1 22 error [email protected] dev:webpack-dev-server --inline --progress --config build/webpack.dev.conf.js 22 error Exit status 1 23 error Failed at the [email protected] dev script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Administrator\desktop\websoftic\node_modules.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Administrator\bin;C:\orant\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Java\jdk1.8.0_161\bin;C:\orant\jdk\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Program Files\Java\jdk1.8.0_161;C:\Users\Administrator\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Roaming\npm
9 verbose lifecycle [email protected]~start: CWD: C:\Users\Administrator\desktop\websoftic
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: react-scripts start
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess. (C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Users\Administrator\desktop\websoftic
16 verbose Windows_NT 6.3.9600
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "start"
18 verbose node v10.15.3
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: react-scripts start
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

if have this type of error ....any help !

fix it in package.json file. it's problem with webpack version, delete character ^ before version.
It's working for me. Hope help.

Same issue. Still not fix it.

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'serve' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle [email protected]~preserve: [email protected]
6 info lifecycle [email protected]~serve: [email protected]
7 verbose lifecycle [email protected]~serve: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~serve: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\zcsys\manage\node_modules.bin;C:\Users\Administrator\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Administrator\bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Git\cmd;C:\wamp64\bin\php\php7.2.14;C:\ProgramData\ComposerSetup\bin;C:\Program Files\PuTTY;C:\Program Files\dotnet;C:\Program Files (x86)\dotnet;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\DTS\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn;C:\Program Files\nodejs;C:\Users\Administrator\AppData\Roaming\Composer\vendor\bin;C:\Users\Administrator\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Local\Programs\Fiddler;C:\wamp64\bin\mysql\mysql5.7.24\bin;C:\Users\Administrator\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle [email protected]~serve: CWD: E:\zcsys\manage
10 silly lifecycle [email protected]~serve: Args: [ '/d /s /c', 'vue-cli-service serve' ]
11 silly lifecycle [email protected]~serve: Returned: code: 1 signal: null
12 info lifecycle [email protected]~serve: Failed to exec serve script
13 verbose stack Error: [email protected] serve: vue-cli-service serve
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd E:\zcsys\manage
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "serve"
18 verbose node v10.16.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] serve: vue-cli-service serve
22 error Exit status 1
23 error Failed at the [email protected] serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I had same problems, same log file, I resolved it in 2 steps:
1.deleting "node_modules" directory in project
2.npm install
after that npm start was working like charm :)
I hope this will resolve your issues as well

rm -rf node_modules/
npm install

It works! If anyone is using Yarn, the error persists if you reinstall the package using Yarn. After installing the packages using npm, it worked! Thank you!

npm update worked for me. not sure which dependency was causing it but everything is fine now.

What fixed it for me:

I ran npm update as suggested by @bryanSME. It seems I had a different issue. This time when I ran npm start, I saw that there was an ENOSPC error (it may have been there before and I might have not noticed it). I see that @ardf69 also mentions this error.

Searching for ENOSPC took me to this thread. Using the first command in the selected answer (I am not using Arch Linux so I ignored the second and third command) fixed it for me.

Also the problem may be caused by existing warnings.

I have such error during npm run build "Treating warnings as errors because process.env.CI = true. Most CI servers set it automatically. Failed to compile"

Get rid of warnings or set this variable to false

Still no answer to this, I'm having the same problem...

I ran into the exact same problem all of a sudden.

Yesterday everything was fine, this morning, without doing anything. Poof.... :-s

npm ci
remove node_modules and npm install

updated npm and node

Untill I updated NPM to the latest version and node to the latest version
Logged out of the system, logged in again and solved..

ok, I just forgot create config file that was ignored in .gitignore (.\src\configs\config.js) and also got the same error.
mb helpful somebody

I removed the node_modules
run the "npm install"

And now it works.

I found that my hosts file was lost, but my npm run dev was not localhost but relocated in hosts, then I created a new hosts, and it was fine after that.

So, after spending ridiculous amount of time trying to solve the issue (generally all the steps that I've found were involving reinstalling dependencies in one way or another) I've found the answer.

It turns out that the latest node.js issue has some issues with Windows and the only way to fix this for me was to download previous version. I've downloaded it from:

https://nodejs.org/en/download/releases/

the version that fixed it for me was Node.js 10.x

Quick and painless (almost)

I hope that this will help someone who will be stuck with a similar issue...

https://stackoverflow.com/questions/58648120/npm-err-code-elifecycle-starting-issue

In my case I solved it with more RAM

i also solved it with relase more memnory space, thank you @marcell93

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sanderswang picture sanderswang  路  3Comments

Akryum picture Akryum  路  3Comments

joshuajohnson814 picture joshuajohnson814  路  3Comments

BusyHe picture BusyHe  路  3Comments

brandon93s picture brandon93s  路  3Comments