[node.js] What does the ELIFECYCLE Node.js error mean?

What does ELIFECYCLE mean?

Here's my app code: https://gist.github.com/samholmes/388ca4552c5936b52c5d

When I run the 'blast-emails' command, it will run for a while until shortly crashing with the error:

npm ERR! Linux 3.2.0-4-amd64
npm ERR! argv "/root/.nvm/versions/io.js/v1.6.1/bin/iojs" "/root/.nvm/versions/io.js/v1.6.1/bin/npm" "run" "live"
npm ERR! node v1.6.1
npm ERR! npm  v2.7.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] live: `NODE_ENV=production node app.js`
npm ERR! Exit status 137
npm ERR! 
npm ERR! Failed at the [email protected] live script 'NODE_ENV=production node app.js'.
npm ERR! This is most likely a problem with the emailer package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     NODE_ENV=production node app.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls emailer
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /apps/emailer/npm-debug.log

The npm-debug.log file is also included in the gist.

I'm looking for one of two answers: What does ELIFECYCLE mean? (or) Why am I getting the error in my application code?

This question is related to node.js

The answer is


One might think this is because outdated versions of npm and node, but it's not the case.

Just as Pierre Inglebert says, if you look into the source you can see that End of lifecycle means the program unexpectedly stopped. This can have various reasons. So it's not a syntax error and not an expected exception/error.

The error appeared to me when a different tool was already using the http port (3000) defined in my node scripts. When you run your node app on port 80, make sure you have stopped Apache webserver (as an example).


In my case, it was because of low RAM memory, when a photo compression library was unable to process bigger photos.


For me it was a ternary statement:

It was complaining about this line in particular, about the semicolon:

let num_coin = val.num_coin ? val.num_coin || 2;

I changed it to:

let num_coin = val.num_coin || 2;

at process._tickCallback (internal/process/next_tick.js:10
4:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] sample: `node src/server/dat
a/seed-db.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] sample script.
npm ERR! This is probably not a problem with npm. There is lik
ely additional logging output above.

npm ERR! A complete log of this run can be found in:

I have the same issue here is how I got solved finally! the error: my error from the terminal when i run npm run sample after correcting my database connection username and password I was using mlab for my database and under the file .env i forget to properly put the user name and password. When I correct that I works.

> [email protected] sample /Users/mohammedr.kemal/Downl
oads/Ex_Files_ANGULAR_API_AUTH/Exercise Files/Ch01/01_04/start
> node src/server/data/seed-db.js

connected to mongodb...
connected to mongodb...
2 records inserted.
closing connection...
done.
12 records inserted.
closing connection...
done.

So it might be good to look any data connection we made in our code if we have.


When running Webpack build I was getting similar error because node doesn't understand async await keywords on older versions. I added webpack babel-plugin-transform-async-to-generator and it was solved. This replaces them with promises.


The Windows solution is the same as the Linux sudo answer. Run the npm start (or whatever) as Administrator. I had added a new module to my project. Worked on some machines but on others that were more locked down, not so much. Took a while to figure it out but the new module needed access to "something" that wasn't available without administrator permissions.


It's basically saying it fails to spawn your process not due to permission but to an error in your script. Source

You don't have any problem executing NODE_ENV=production node app.js ?


This issue can also occur when you pull code from git and not yet installed node modules "npm install".


I had the same error code when I was running npm run build inside node docker container.

Locally it was working while inside a container I had set option to throw error when there is a warning during compilation while locally it wasn't set. So this error can mean anything that is connected with stopping the process being done by NPM


Likewise, I saw this error as a result of too little RAM. I cranked up the RAM on the VM and the error disappeared.


I had the same error after I installed new packages or updated them:

...
npm ERR! code ELIFECYCLE
npm ERR! errno 1
...

It helped me to run installation command once again or a couple of times. After that, the error disappeared.


While working on a WordPress theme, I got the same ELIFECYCLE error with slightly different output:

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/7.6.0/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.6.0
npm ERR! npm  v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: `bower install && gulp build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script 'bower install && gulp build'.
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 foundationsix package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     bower install && gulp build

After trying npm install one more time with the same result, I tried bower install. When that was successful I tried gulp build and that also worked.

Everything is working just fine now. No idea why running each command separately worked when && failed but maybe someone else will find this answer useful.


I had this issue when I was running two projects that had the same set up and I already had one running. This meant that the other project couldn't use that port number. As soon as I stopped the other project running I had no issues.


If you came here like I did, after receiving a similar error when trying the React Getting Started guide, you might like to know that the problem could have been caused by not having installed Watchman. Download it here, or install it with Homebrew with brew install watchman and try again: https://facebook.github.io/watchman/docs/install.html

PS: You might want to do a brew update first.


In my case it was permission problem with Linux, instead of writing:

npm run start

I tried:

sudo npm run start

Then put your sudo user password and you're good to go!


In my case I generated a similar error when I copied the project over from another directory. some hidden files, like the critical .babelrc, were missing. SO ahhh... make sure you copy all the files! :)