Johnglazer
Johnglazer

Reputation: 31

Error " ERR_OUT_OF_RANGE" when using npm install

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

Upvotes: 3

Views: 3567

Answers (3)

ChangNoi
ChangNoi

Reputation: 93

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

Upvotes: 0

Master of Ducks
Master of Ducks

Reputation: 628

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.

Upvotes: 2

Johnglazer
Johnglazer

Reputation: 31

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.

Upvotes: 0

Related Questions