What is npm ERR! code ELIFECYCLE? - node.js

I've gotten this same error on two different npm packages and haven't seemed to be able to figure it out. I've checked this answer and I don't have any other servers running. I've also tried deleting my module_packages folder, cleaning npm cache clean and then reinstalling using npm i as many threads have suggested, but I still get the same error.
Windows 10 64bit
Node 8.9.4
npm 5.6.0
C:\Users\hunter\Documents\vid>npm install npm install github:storj/node-libstorj --save
> storj#5.1.0 preinstall C:\Users\hunter\Documents\vid\node_modules\storj
> node ./download.js
Unable to download libstorj for platform: win32 and arch: x64
npm WARN vid#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! storj#5.1.0 preinstall: `node ./download.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the storj#5.1.0 preinstall 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! C:\Users\hunter\AppData\Roaming\npm-cache\_logs\2018-03-25T15_44_06_578Z-debug.log
Any ideas on what might be causing the error would be helpful.

I have good and bad news for you. The good news first: Everythings fine with your computer.
The bad news: The module you would like to install is incompatible with windows operating systems. Have a look at the first line of your error message:
Unable to download libstorj for platform: win32 and arch: x64
There is already an open issue for this problem on GitHub, see: https://github.com/Storj/node-libstorj/issues/43
As mentioned in this issue there are multiple problems:
download/unzip not working
not compiling because some linux-only functions being used (access function)
not linking (it seems nettle and some other link fails)
So you have two options: Wait until this issue gets fixed - or - switch your operating system ;-)

I was getting a "code ELIFECYCLE" error trying to run "usemin" and "imagemin" node-modules via script entries in package.json. These script entries were given in a Coursera "Full Stack Developer" course:
"imagemin": "imagemin img/* -o dist/img/ &&
"usemin": "usemin index.html -d dist -o dist/index.html",
The first line should have read:
"imagemin": "imagemin --out-dir=dist/img/ img/**/*.{png,jpg,git}"
And the issue with usemin giving a "code ELIFECYLE" error was finally traced to the fact that I had installed the API version ("npm install usemin") rather than the cli version ("npm install usemin-cli).
Hope the above helps some other nubbie avoid what now look like an obvious pair of mistakes!

Related

Failed at the bcrypt#3.0.2 install script

I am installing bcrypt for my project to use salting in hash function using the command -
npm i bcrypt#3.0.2
My current node version is 10.16.0
I have installed nvm to update my previous node version from 10.15.3
but while installing I am getting these errors-
"node" is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt#3.0.2 install: "node-pre-gyp install --fallback-to-build"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#3.0.2 install script
npm ERR! This is probably not a problem with npm, There is likely additional logging output above.
npm ERR! A complete log og this run can be found in:
npm ERR! C:Users\Ansh\AppData\Roaming\npm-cache\_logs\2019-06-17T06_05_15-252Z-debug.log
Update
I have managed to install the bcrypt package but the issue mentioned is still present. Actually, I am using windows OS and for running these commands I was using Hyper as terminal, which is creating these errors. I tried to run the bcrypt install command using Administrative privileges through PowerShell and it was successful, without any errors.
I tried to install a few more packages(like passport, express-session, etc) through Hyper and I am facing somewhat similar errors, but when I run those in PowerShell, it works just fine.
I have managed to make things work for me, but I still don't understand the logic behind this. If anyone has any idea about it, please share and then I can close this.
There are a lot of bug reports at the official repository about this - have you made sure that you've read the full installation instructions for this library, including the installation of some build tools? Maybe running the following line in a command line with admin privileges already helps?
npm install --global --production windows-build-tools
hi try this command line maybe its will help you
npm install bcrypt#3 --save

Having a hard time getting the Angular CLI server to start

I'm sure this isn't the first time you've run into this issue. I've researched over google, youtube, and stackoverflow on this issue, and it seems like this is an isolated incident. I don't know if it's an issue with versions, but I have been taking the Pluralsight course on Angular with Deborah K. I downloaded her Github version of the boilerplate starting files from https://github.com/DEborahK/Angular-GEttingStarted
I followed the course and installed the dependences from the package.json file using the integrated terminal. When I tried to run the script npm start which translates into ng serve -o I get this error message:
apm#0.0.0 start /Users/mateo/Desktop/projects/angular
ng serve -o
Cannot read property 'config' of null
TypeError: Cannot read property 'config' of null
at Class.run (/Users/mateo/Desktop/projects/angular/node_modules/#angular/cli/tasks/serve.js:21:63)
at check_port_1.checkPort.then.port (/Users/mateo/Desktop/projects/angular/node_modules/#angular/cli/commands/serve.js:110:26)
at
at process._tickCallback (internal/process/next_tick.js:118:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! apm#0.0.0 start: ng serve -o
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the apm#0.0.0 start 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! /Users/mateo/.npm/_logs/2018-03-26T22_16_46_516Z-debug.log
Sandys-MacBook-Pro:angular mateo$
Is there a best practice way to troubleshoot these kind of issues? Is there a better way to run these scripts or should I use a sandbox VMware linux install to run these fresh instead of running off my Macbook? Any help is appreciated! Thank you!
I was able to fix this issue by deleting all of the node_modules and re-installing the AngularCLI from scratch off of the Angular website.

NPM Install Error - Node-Pre-Gyp

When I try to run npm-install I get:
npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\Program Files
(x86)\nodejs\node.exe" "C:\Program Files (x8
6)\nodejs\node_modules\npm\bin\npm-cli.js" "install" npm ERR!
node v4.0.0 npm ERR! npm v2.14.2 npm ERR! code ELIFECYCLE
npm ERR! v8-debug#0.4.6 install: node-pre-gyp install
--fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the v8-debug#0.4.6 install script 'node-pre-gyp install --fal
lback-to-build'. npm ERR! This is most likely a problem with the
v8-debug package, npm ERR! not with npm itself. npm ERR! Tell the
author that this fails on your system: npm ERR! node-pre-gyp
install --fallback-to-build npm ERR! You can get their info via: npm
ERR! npm owner ls v8-debug npm ERR! There is likely additional
logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:_Src\Personal\rzaleski\ILikeThis\npm-debug.log
I tried a number of things (installing VS C++ redistrib, npm install --msvs_version=2013, etc). Nothing seems to work.
Do you have any ideas how I can find out the actual error (the log is a bit daunting).
UPDATE: What I ended up doing was reverting from Node v4.0.0 to NODE v0.12. This is not really a fix to the issue, but it got me around my issues.
Go to: (http://www.devdocs.io) look # the npm section. Must use desktop, must use windows if possible (Mac layout is weird for some reason) Follow the steps detailed for "resetting npm cache"
Node-gyp is a P.I.T.A. and often blows up installs among other things. I have a horrible time with it every time I come back to an environment I haven't used in a while and try to use it again.
Alternatively, you can uninstall node, and attempt to reinstall using chocolatey if you're on windows or brew if you're on a mac. Make sure you sudo commands when installing to mac.
You're most likely going to have to clean out the npm cache, possibly reinstall nodejs, and possibly reinstall node-gyp.
NOTE: Before you go about the above mentioned steps, first make sure that your configurations are compatible, including your python version for node-gyp. (https://www.npmjs.com/package/node-gyp) Also, I have solved the C++ redistributable issues several times without touching anything C++ related, just so you know this error is not indicative of C++, but rather local settings and compatible software versions that interact with node + npm NOT C++ related (for instance, your python version interacting with node-gyp)
There is no straightforward "run this and that" to fix, you kind of have to muddle through it, and I can promise you that you'll have to do it more than once. But the more you fix node + npm + node-gyp, the more able you will be to quickly remedy all issues in the future. The links above should sort you out no problem though. Just walk through them slowly and thoroughly as instructed.
All i did is uninstall node and install it again, and during the installation, check the box telling you to install the needed dependencies and complete your installation.
If it persists, locate the package that is causing this error and install it seperately.
Example:
npm install -g node-gyp
npm install bcrypt

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! emailer#0.0.0 live: `NODE_ENV=production node app.js`
npm ERR! Exit status 137
npm ERR!
npm ERR! Failed at the emailer#0.0.0 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?
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 ?
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.
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! foundationsix#1.0.0 postinstall: `bower install && gulp build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the foundationsix#1.0.0 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.
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.
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.
at process._tickCallback (internal/process/next_tick.js:10
4:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ng-contact-manager#0.0.0 sample: `node src/server/dat
a/seed-db.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ng-contact-manager#0.0.0 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.
> ng-contact-manager#0.0.0 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.
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.
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.
This issue can also occur when you pull code from git and not yet installed node modules "npm install".
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.
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
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!
:)
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;
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 found the solution here - https://javahowtos.com/guides/124-docker/418-npm-exit-status-137-when-building-a-docker-image.html
It says - The cause of this specific npm error status usually means that Docker is going out of memory. So, when this happens, the Linux kernel just kills the process.
if you are running on ubuntu, please check your nodejs version. please update the version to the latest and clear the cache and reinstall the modules (npm install) and build.
or otherwise
please upgrade your RAM size and try again. it'll work sure.
First, you will have to remove the npm cache and upgrade to the latest version of the node and npm will resolve the issue.
sudo npm cache clean -f
sudo npm install -g n install n
sudo n stable
The first command will force clean the npm package manager's cache, After the second and third commands, a stable version of the node and npm will be installed. then you can execute npm i and npm run build for creating an optimized production build.
This solution worked for the same error on the npm run build command in nextjs.

error while installing gruntjs (node.js/npm package)

I'm trying to install grunt.js. As the official docs says, I should run
npm install -g grunt-cli
as root (I'm using ubuntu linux). I'm trying - and I get the following error:
$ sudo npm install -g grunt-cli
npm ERR! sudon't!
npm ERR! sudon't! Running npm as root is not recommended!
npm ERR! sudon't! Seriously, don't do this!
npm ERR! sudon't!
npm ERR! couldn't read package.json in .
npm ERR! Error installing .
npm ERR! Error: ENOENT, No such file or directory 'package.json'
npm ERR! Report this *entire* log at <http://github.com/isaacs/npm/issues>
npm ERR! or email it to <npm-#googlegroups.com>
npm ERR! Just tweeting a tiny part of the error will not be helpful.
npm not ok
Can someone please explain:
[1] why npm says `sudon't` and grunt docs says `do sudo`? And what is it all about?
[2] I want to install the grunt as a tool. Why does the message complains about missing package.json which is project-dependent (and I don't want to run grunt on any project, I want to install it globally first)?
[3] what can I do to make it install successfully?
The solution was quite tricky... I'm using ubuntu oneiric ocelot, which was still maintained one week ago (it's not that old). I installed node.js through default ubuntu packages and it turned out to be the problem - I got 0.4.9 version installed, which seems to be old, odd and strange (I had no experience with node.js before). I removed it and followed instructions from https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager - added remote package repository and installed node.js from there. Now I've got a shiny 0.10.5 with sudo npm install working perfectly fine with no complaints.

Resources