Npm throw an error after update to nodejs 8

Viewed 16932

After I update my nodejs to the latest version I always get error when trying to run npm install to install packages:

npm WARN registry Using stale data from http://registry.npmjs.org/ because the host is inaccessible -- are you offline?
npm WARN registry Using stale package data from http://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npmjs.org/escope failed,      reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:80
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

I don't have any issues with my internet connection and I disable the route to https: https://registry.npmjs.org and replace it with http - the first install worked and right after start not working again.

node version 8.2.1

npm version 5.3.0

Thanks for any help.

4 Answers

Set the proxy as written below in your command prompt.

npm config set proxy http://1X.XX.X.40:80

It solved the issue.

I try the first solution, ping registry.npmjs.org and add it to host file , not work, and I try the second way :

npm config get proxy
npm config rm proxy
npm config rm https-proxy

And that work for me. With "npm config get proxy" i had a value with port 8080 now it's null.

I don't know where that value comme from.

Related