npm ERR! errno -5 - node.js

hi i am getting this error when I try typical starter command with react native
react-native init test
returns this error
npm WARN react-native#0.44.0 requires a peer of react#16.0.0-alpha.6 but none was installed.
Setting up new React Native app in /Users/xxxx/ReactNativeProjects/gpss
Installing React...
gpss#0.0.1 /Users/xxxxx/ReactNativeProjects/gpss
└── react#16.0.0-alpha.6
Installing Jest...
npm ERR! code EIO
npm ERR! errno -5
npm ERR! syscall read
npm ERR! EIO: i/o error, read

You could uninstall react-native and then use the following command:
npm install react#reactversion --save.
Note (reactversion) is your desired version you want to have.
You could also just try reinstalling it as:
npm install react --save
Or upgrade with:
npm update react-native
Eventually cleaning the cache worked out fine. Hope this answer solves any user's problem in the future.

I just had the same problem on Windows, using Virtual Studio Code. I uninstalled an unrelated program shortly before the error and I suspect that was the cause. So I restarted my PC and updated Windows and the npm errors were gone. Everything is working and disaster averted.
Try closing background tasks, updating and/or restarting your computer.

Related

attempting to deploy meteor application. Fails when running NPM INSTALL

Sorry for the following wall of text.
So I've been using someone else's meteor app. (they open sourced it) It's currently un-built and I've been running it on dev-mode. It's a lot slower than expected and users are having issues connecting to my local machine. So I'm attempting to deploy the app by following: https://guide.meteor.com/deployment.html#deploying.
So I've been getting errors when trying to run npm i. My dad recommended me to run npm cache verify and try again, then npm cache clean as a last resort. Neither worked and I've still am getting errors. Although as soon as I tried again after running npm cache verify the error amount skyrocketed. I unfortunately don't have the errors I got before I cleared my cache but I have the current logs here: https://pastebin.com/dAcRnE9v But here is a snapshot:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fibers#2.0.2 install: `node build.js || nodejs build.js`
npm ERR! Exit status 1
npm ERR! Failed at the fibers#2.0.2 install script.
I honestly don't have any idea what todo. I've never worked with meteor before, nor the fibers module that's failing. I don't even know if this is the right place I should be asking for help.
I once had fibers npm package in my package.json which caused a similar error. Once I removed it everything built just fine.
You can't change Meteor's version of node - for compatibility reasons it bundles node/npm with Meteor to protect you. Just prefix all your npm/node commands with meteor like this:
meteor npm install
It won't use the node version (13.x) that you have installed

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

Create New React Native app

I am getting an error on creating my first react native app.
I am using following guide -
https://facebook.github.io/react-native/docs/getting-started.html
https://github.com/react-community/create-react-native-app
$ npm install -g create-react-native-app
--Worked fine
$ create-react-native-app my-first-native-app
--app created without errors
$ npm start
--gives error
Error: React native is not installed. Please run `npm install` in your project directory.
1:09:05: Error starting packager: Error: Couldn't start project. Please fix the errors and restart the project.
at C:\xdl\src\Project.js:1329:11
at Generator.next (<anonymous>)
at step (C:\reactJs-projects\my-first-native-app\node_modules\xdl\build\Project.js:1735:191)
at C:\reactJs-projects\my-first-native-app\node_modules\xdl\build\Project.js:1735:361
at <anonymous>
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-first-native-app#0.1.0 start: `react-native-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-first-native-app#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Tried fixing with downgrading npm to version 4 as recommended all over that version 5 has bugs.
npm i -g npm#4
I have also tried latest npm but neither of them worked.
When I run npm install on my project directory, instead of installing/updating my packages, it is giving following error
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://github.com/npm/npm/issues>
I see all dependencies downloaded in node_modules though
Any suggestion on what I have missed?
What I also noticed is when the app is created (using create-react-native-app my-first-native-app) it also added following error in console
yarn install v0.21.3
[1/4] Resolving packages...
warning jest-expo > jest > jest-cli > istanbul-api > istanbul-lib-hook#1.2.1: 1.2.0 should have been a major version bump
[2/4] Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-web-maps/-/react-native-web-maps-
0.1.0.tgz: invalid tar file".
info If you think this is a bug, please open a bug report with the information provided in "C:\\reactJs-projects
\\MyNewNativeApp\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Failed to install
Thank You!
Reinstall your NPM/YARN and get the newest version of React Native i have this problem too
after create your project with
$ create-react-native-app my-first-native-app
after you should enter your project folder :
$ cd my-first-native-app
and then open emulator or connect to tour device and run with
$ npm start
or
$ react-native run-android
pay attention you had installed android-SDK and android-JDK and your emulator is running
After trying different versions, I ended up using yarn and it worked on first instance. If anyone struggles with similar problem, then I would recommend using Yarn and move on. One can switch back to npm after the app is created. This is very common issue reported and for many developers it works with certain version.
Create new project using command : npx react-native init ProjectName
Create new project using particular version of react native :
npx react-native init ProjectName --version X.XX.X
After that go to project location
cd ProjectName
Run application on android platform
npx react-native run-android

Fail to install npm package "npm ERR! errno -4048"

I'm trying to install npm package (node-xmpp-server) but it fail to install. previously when I'm trying to install a package that is install globally instead of locally, but now it's not installing at all. Plz Help me.
npm install node-xmpp-server
error is: npm ERR! errno -4048
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "c:\Program Files\nodejs\node.exe" "c:\Program
Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "node-xmpp-server"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! path c:\Users\Jaseem Abbas\Documents\node_modules\node- xmpp-server\examples
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! Error: EPERM, unlink 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, unlink 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! path: 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples' } npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EPERM, unlink 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EPERM, unlink 'c:\Users\Jaseem
Abbas\Documents\node_modules\node-xmpp-server\examples']
npm ERR! error rolling back errno: -4048,
npm ERR! error rolling back code: 'EPERM',
npm ERR! error rolling back path: 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples' }
Kill whatever process is locking your files
It seems like this kind of error can be caused by a file permissions lock - I experienced something very similar (the same ERRNO: -4048) when installing whatwg-fetch.
I found that a Visual Studio instance I had open at the same time was acquiring all kinds of files which it didn't need. Once I closed that down, the install worked perfectly.
This may be a quickly-checked possible cause to eliminate before moving on to more drastic measures...
if you still have troubles with this error and maybe you upgrade the node version to 5.4 > ... that version presents an error. here the solution that basically consist in downgrade node version
In Windows will be:
npm install -g npm#5.3
That's works for me.
I was having the same problem and I found the following solution:
remove both of
%ProgramFiles%\nodejs\npm
%ProgramFiles%\nodejs\npm.cmd
Go into %ProgramFiles%\nodejs\node_modules\npm and copy the file named npmrc in the new npm folder, which should be %appdata%\npm\node_modules\npm. This will tell the new npm where the global installed packages are.
Restart Windows and it worked.
Found this over here (the npm troubleshooting section). Credits to the authors there
It seems that this error can manifest for more than one reason, so there probably won't be a single fix which works for everyone.
However, concurrency issues often are the cause of the failing installs. According to the accumulated wisdom in one of the related npm issue threads, which has received nearly 180 comments so far, the underlying problem is
a race condition between asynchronous I/O operations accessing the same files on the harddisk. You can certainly influence it by cleaning up the harddisk e.g. with "npm cache verify" or moving the project to a SSD, but this does not solve the root cause of the problem.
Likewise, closing the IDE or disabling the virus scanner works sometimes, for some people, but does not really fix the problem for good if concurrency issues are behind it.
A patch has landed in npm 5.6.0. According to initial reports, it seems to do the trick. So if your npm --version is lower, update to 5.6.0 (or whatever the current version is when you read this):
npm uninstall -g npm
npm install -g npm#5.6.0
as suggested here.
If that doesn't help, then perhaps a file lock is the true cause. And closing the IDE, or disabling the virus scanner temporarily, or some similar action is indeed the way to go, as #Oly has said above.
Had the same issue
Closing visual studio solved the problem
Upgrade npm to 5.4.2 it will fix this problem.
Command to install : npm i -g npm#5.4.2 or npm i -g npm
if still doesn't work try clearing cache using npm cache clean
you can use force like this npm cache clean --force
Someone said it was due to npm bug https://github.com/npm/npm/issues/9696
Adding "--force" to install allegedly works around the problem.
For me #Oly's solution worked, I'll just add for Angular folks that it was ng serve -o that had locked the files. Yep - don't run npm install while ng serve is running for the project.
I had this same problem, after setting up node.js I followed parts of a guide intended for unix and ended up moving my current working directory to a new folder, but I forgot to copy the .npmrc file from the old location to the new one. I also changed the location of my prefix away from %AppData%, which I found by using npm config ls -l to compare my current settings to the default. The two clues here were that I had a line at the start called userconfig pointing to my .npmrc file, which was in a different location, and that my prefix was overridden from the default value. Changing this back to the default fixed the problem.
Try resetting these to the defaults and check what your config settings are. I'm not sure if reinstalling node.js would help anything if it was still referencing your old settings.
I tried following solutions, I don't know which one worked for me.
Ran reactive-native init in command prompt as Administrator (on Windows OS), hoping works well with sudo reactive-native init on Mac OS
Ran npm cache clean command in Command prompt.
Disable your antivirus for time being.
Try any of the solution or all,
This is a long standing issue with npm that they seem to have no interest in fixing. Various things others are mentioning will work sometimes (e.g. closing running programs, downgrading the version, etc...). It's been generally limited to Windows installations, though I've even had it happen a bit in Linux lately as well.
np init
This will create a dummy package.json.
Open the file and enter your required dependencies list.
Now go for:
npm i
This fixed the problem for me.
In my case fetch same issue. Then first I stopped npm run watch then try again then it works.
Do the followings. This might be permission issue.
Uninstall all antivirus program and restart system
Install yarn
Delete package.lock.json and node_modules folder (if any)
Clear the cache (npm cache clean --force)
Close VS code or other code editor tool (If opened)
now run yarn install
This should resolve the issue.
I had this same issue, and determined that it was caused by having link-sharing enabled for the Google Drive folder that my project was in. Once I moved it to a non-link-sharing folder everything worked fine.
In my case, I right clicked the json file that was mentioned in the error, Unchecked the read only flag, and it worked
If you have XAMPP server running in the background, kill it.
Then run the installation again.
Worked like magic for me
I had the same problem...here is the fix:
install nodejs in your local directory that does not need admin privilege.
I changed the npm version and this did not happen again
I just run npm cache clean, and worked for me
Delete package-lock.json
and try again

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.

Resources