Error " ERR_OUT_OF_RANGE" when using npm install - node.js

I tried to create a new NodeJs project, when i ran "npm init" the package.json was created successfully but when I tried to run "npm install express" it showed "npm ERR! code ERR_OUT_OF_RANGE". I am not able to run npm install without getting this error.
I tried to install other packages, i tried sudo, and I removed npm/node and reinstalled nvm/node but it is still the same.
Thank you for your help !
npm install express
npm ERR! code ERR_OUT_OF_RANGE
npm ERR! The value of "err" is out of range. It must be a negative integer. Received 536870212
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/me/.npm/_logs/2019-09-18T14_49_07_222Z-debug.log

The issue is a mismatch between your versions of Node and NPM.
This can occur when one is updated without the other.
To prevent these issues, use nvm to manage your Node version:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
# Example: Selecting Node v13
# For complete list of available versions run `nvm ls-remote`
nvm install 13
nvm use 13
This will select matching versions of Node and NPM.

This error was caused by a the most recent version of node which was 12.10.0, when I installed and used the 10.16.0 version of node, the error was gone.

i ran into something very similar with react native - metro and it seems I just had to deactivate my firewall LULU.

Related

How do you fix and error of an Invalid version of NPM for installing #nestjs/core?

Hey so i just recently started learning Nestjs and I was asked to setup the environment on my Chromebook(Linux terminal). All packages have been successfully installed except a package #nesjs/core. I've tried running the command to install the package npm install #nestjs/core but anytime i run the command it keeps giving me this error:
npm ERR! Invalid Version:
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jefferson/.npm/_logs/2022-07-09T07_13_30_344Z-debug-0.log
So far I've tried changing my version of npm to version 6.2.0, deleting and reinstalling nodejs and npm but there's been no positive result.
Please what else should I try doing
If your Node version is very recent, try downgrading. Stable version 14.16.1 worked.

npm i not working? npm ERR! Unexpected token '.'

My npm install seems to have stopped working out of nowhere, regardless of if i do npm i or npm install I keep getting an error saying npm ERR! Unexpected token '.' The other npm commands seem to be working perfectly but I can't install any modules because of this error. I'm using npm 8.7.0 and node v14.18.1
The simplest solution I could find and what worked for me was completely removing and unisntalling everything to do with nodejs and npm from my laptop. I then reinstalled it back with no issues and am able to use the command now.
As mentioned in one of the answers, try deleting the node_modules folder and package.lock.json. Use
sudo npm install
And if that doesn't work, what I would suggest is that you use yarn. If you don't know what yarn is, it's just a package manager like node.
You can install yarn by using the following command:
npm install -g yarn
After this make sure all the node modules and package.lock.json is deleted. Now run the command
yarn install
Hopefully, this will fix your issue.

npm Install error- node modules but no package-lock.json

I'm getting an error with my npm install and would love some help/advice.
ELIFECYCLE
ENOENT
spawn bash
yorkie#2.0.0 install `node bin/install.js`
spawn bash ENOENT
Failed at the yorkie#2.0.0 install script
This is probably not a problem with npm. There is likely additional logging output above.
My node path is set in my environmental variables. My node version is 10.24.1 and npm version is 6.4.1
I am using nvm for windows to manage versions.
Whenever I run npm install I get this error, and node modules is created, but package-lock is not.
I have deleted node modules and ran npm cache clear with no success.
Any tips appreciated!
Try and run the following command.
npm install --registry=https://registry.npm.taobao.org
If that doesn't work, see the following Issues page on GitHub.
yorkie#2.0.0 error
EDIT: Just noticed, you should update your Node.js version. It is on v10 and the current LTS version (at the time posted) is v16. This is just a suggestion, although it might solve your issue.
This solved it for me!
npm config delete script-shell
Source: https://stackoverflow.com/a/46006249/15787997

npm ERR! must provide string spec

I'm having this error since a while, in this case, the problem occur executing the following command.
npx create-react-app my-app
Actually, it happens with any npm commands as well, I tried deleting package.json, changing npm versions and yet didn't work, so I'm here asking for help.
This is the entire error:
C:\Users\c>npm install
npm ERR! must provide string spec
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\c\AppData\Local\npm-cache\_logs\2022-01-28T16_50_23_009Z-debug.log
Version of npm and node:
node --version
v16.13.2
npm --version
8.3.2
I had the same issue, it was a missing version in my package.json
look like mistakenly I removed some text
"dependencies":{
"angular/cli" :"{}"
}
try to update your npm: npm upgrade
then: npm clean cache
Following, i'm in the exact same position. Tried changing the NodeJS version using NVM and now some of the commands work (npm -v shows im running 8.1.0) but npm update and npm/npx create-react-app give me an " ERR! must provide string spec " !
I faced this same issue yesterday.
This is what I did to resolve it:
Uninstalling node entirely and removing node_modules and package.lock.json from the project directory.
Install node afresh and run npm install in your project directory.
I tried to reactivate an old project which had packages noted down differently then usual in package.json. They had an id and locator parameter, like:
"ImagePicker": {
"id": "ImagePicker",
"locator": "https://github.com/dhavalsoni2001/ImagePicker.git"
}
After removing / replacing them by version numbes, i could install.

Why am I getting error "No valid versions available for undefined" while installing create-react-app

I'm trying to install React through command prompt. NodeJS is already installed.
When I try to run this command:
npm i -g create-react-app
It is displaying error as shown below:
npm ERR! code ENOVERSIONS
npm ERR! No valid versions available for undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\xyz\AppData\Roaming\npm-cache\_logs\2019-12-10T10_51_39_2222-debug.log
Sometimes this can happen when you are using a private NPM registry / proxy registry and it has corrupted metadata. I've seen this happen with Sonatype Nexus 3 - there were corresponding error messages in the server logs.
Are you sure you have the right Node version? Try updating NodeJS or try running: npx create-react-app my-app
you should check this out issue.
If the problem still exist, please check your versions with this:
npm -v
node -v
For me this error came up because I had a version number that did not exist for a package I wanted.

Resources