Request to http://registry.npmjs.org/check failed, reason: connect ECONNREFUSED - node.js

When I run this commend "npm install -g check" on cmd I have the following error
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to http://registry.npmjs.org/check failed, reason: connect ECONNREFUSED 10.141.0.60:80
using:
OS: Windows 10
Node Version: v8.10.0
npm version: 5.6.0
Domain (AD): kmsd
User: mu789
Proxy: 10.40.140.60:4000
I tried following commends, but still have the same issue
npm set strict-ssl=false
npm config set registry "http://registry.npmjs.org/"
npm config set proxy http://kmsd\mu789:ab_132#10.40.140.60:4000/
npm config set https-proxy http://kmsd\mu789:ab_132#10.40.140.60:4000/
--
npm config set proxy http://kmsd%5Cmu789:ab_132#10.40.140.60:4000/
npm config set https-proxy http://kmsd%5Cmu789:ab_132#10.40.140.60:4000/
--
npm config set proxy http://mu789:ab_132#10.40.140.60:4000/
npm config set https-proxy http://mu789:ab_132#10.40.140.60:4000/
--
.npmrc
proxy=http://kmsd\mu789:ab_132#10.40.140.60:4000/
https-proxy=http://kmsd\mu789:ab_132#10.40.140.60:4000/
--
.npmrc
proxy=http://"kmsd\mu789:ab_132"#10.40.140.60:4000
https-proxy=http://"kmsd\mu789:ab_132"#10.40.140.60:4000
--
.npmrc
proxy="http://kmsd\mu789:ab_132#10.40.140.60:4000/"
https-proxy="http://kmsd\mu789:ab_132#10.40.140.60:4000/"
I tried all methods in Is there a way to make npm install (the command) to work behind proxy? but still have the issue.

format for proxy "http://mu789:kmsd#10.40.140.60:4000" which should be put in .npmrc file.
Please try this and check if you still face this isue.
Assuming kmsd is password for the corp

I had the same issue, was able to successfully install it outside my company's corporate network or try adding the proxy to proxy bypass list. Hope it helps!

Related

unable to use npm and yarn with proxy

I'm trying to create a strapi backend and I'm on a proxy server.
Everytime i run npx create-strapi-app#latest backend the err occurs
npm ERR! code ERR_INVALID_URL
npm ERR! Invalid URL
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Neha\AppData\Local\npm-cache\_logs\2023-01-15T04_44_45_518Z-debug-0.log
I've read various stackoverflow questions regarding how to set proxy to npm but none worked for me.
I used below commands
npm config set proxy http://username:password#proxyname:8080
npm config set https-proxy http://username:password#proxyname:8080
npm config set strict-ssl false
after running all these commands, when i get my config list
npm config ls -l
it shows my proxy = null
; https-proxy = null ; overridden by user
; proxy = null ; overridden by user
I don't know what could be the reason.
Any help is much appreciated!
Thanks
Edit: It's fixed. Actually I changed my network :) and reset all proxies of npm, yarn and git

Unable to install ionic in windows using npm

I'm trying to install ionic using npm command
npm install -g ionic cordova
But installation failed. I'm have setup the proxy as well.
npm version:5.6.0
Proxy setup
npm config set strict-ssl false
npm config set registry "http://registry.npmjs.org/"
npm config set proxy "http://username:password#proxyip:8080/"
npm config set https-proxy "http://username:password#proxyip:8080/"
Since I cannot post the complete error details from the log, I have extracted the error message alone.
silly fetchPackageMetaData error for bn.js#^4.1.1 request to
http://registry.npmjs.org/bn.js failed, reason: connect ECONNREFUSED
proxyip:8080

Npm throw an error after update to nodejs 8

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.
If it's helps to anyone: The only solution that works for me is to ping registry to find the IP. and the fact I have got the IP means I am not blocked
ping registry.npmjs.org
64 bytes from registry.npmjs.org (151.101.60.162): icmp_seq=1 ttl=52 time=87.3 ms
Set the IP to this host on my hosts file (Im in centos /etc/hosts/):
151.101.60.162 registry.npmjs.org
I am almost sure it's some glitch in NPM
You may want to check your NPM proxy settings and perhaps remove it.
npm config get proxy
npm config rm proxy
npm config rm https-proxy
One might expect a fresh install of NodeJS+NPM would not have a proxy configured. Strangely enough, mine did come with a proxy defined, pointing to an IP and port 3128. Removing the proxy did the trick.
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.

npm ERR! Error: connect ECONNREFUSED when trying to update the npm

I'm trying to update the npm (node package manager) using the command:
npm install npm#latest -g
but I'm getting the following error in the command prompt:
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "npm#latest" "-g"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! syscall connect
npm ERR! Error: connect ECONNREFUSED xxx.xxx.xx.xxx:xxx
npm ERR! at Object.exports._errnoException (util.js:1022:11)
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly. See: 'npm help config'
does someone know what this really means?
any help would be appreciated.
Try:
npm config set proxy null
npm config set https-proxy null
npm config set registry http://registry.npmjs.org/
The first two lines will remove proxy's if there any.
Third line will make npm download from the official package registry.
If you are behind a proxy, please make sure that the npm ERR! 'proxy' config is set properly. See: 'npm help config'
See:
https://docs.npmjs.com/cli/config
More info:
How to setup Node.js and Npm behind a corporate web proxy
I have been trying to fix this issue by
npm config set registry http://registry.npmjs.org/
npm config set proxy http://myproxyblabla:myport
npm config set https-proxy http://myproxyblabla:myport
But it didn't help. The only one solution which worked for me is adding additional fields to host file (C:\Windows\System32\drivers\etc\hosts)
151.101.36.162 registry.npmjs.com
151.101.36.162 registry.npmjs.org
This allowes npm to resolve address to server from which it will download needed files.
You can get familiar with closed issue on npm repository where this solution is approved by npm contributors.
I got a similar error when I was using Node JS behind a proxy server. Here's what I had to do to fix it:
npm config set proxy http://jdoe:password123#proxy.company.com:8080
npm config set https-proxy http://jdoe:password123#proxy.company.com:8080
Just replace "jdoe" and "password123" with your own credentials to access the proxy server. Everything after the # is the server domain name, or you can enter the exact IP address too. In my case, both addresses were HTTP (not HTTPS).
To confirm the changes, you can type:
npm config list
and your settings should be listed.
You can get the proxy settings (address) from your browser too.
May be this will help someone in need. I turned to this solution after wasting good 2 hours as my corporate proxy server on work laptop was not getting resolved..!
I removed both proxy and https-proxy from .npmrc file and set only
npm config set registry http://registry.npmjs.org/
Then, I am able to successfully run npm install -g create-react-app
.npmrc file can be found here at C:\Users\<userName>\.npmrc
Cheers! Happy Quarantine Development :p
The problem here is because of proxy. So you need to run the below-mentioned command to remove the proxy and then set the registry from http://registry.npmjs.org/.
npm config set proxy null
npm config set https-proxy null
npm config set registry http://registry.npmjs.org/
And then you can create your first react app by using:
npx create-react-app your-app-name
I had the same problem with my cra and all I had to do was comment out my .npmrc, clean the cache, and run the command npx create-react-app
We faced similar issue recently and our requirement was to use public npm registry for one feature and private registry for another feature. So for private registry npm needs to go via proxy but for public registry we don't need proxy so we created .npmrc file inside our project and added two config variables:
registry and noproxy where noproxy points to the public domain of the registry. This will make sure to skip the proxy config from your global npmrc file.
I had the same error, using Mullvad VPN. It was fixed by enabling IPv6 in Mullvad settings.
We happened to run into this error message because in our setup, the Maven Nexus NPM Repository ran on the same machine and we therefore first used http://localhost/xyz/ as the NPM repository URL.
For whatever reason, localhost was treated as a system-type NPM registry, causing errors.
Changing the NPM repository URL configuration to the computer's hostname, e.g. http://mycomputer.company.intra/xyz/ fixed the issue.
What fixed it for me, was to enable SMB 1.0 in Window's Control Panel on my development PC as follows:
Control Panel > Programs and Features > Turn Windows features on or off > SMB 1.0

NPM doesn't install any modules: network socket hangs up

Salam (means Hello) :)
I have the latest version of node.js installed on ubuntu 12.04, I'm not behind any proxies, and my network settings are correctly configured, and were intact since last time when NPM worked fine. But now NPM hangs up installation of any modules with following error:
nasser#nasser-desktop:~/projects/server v3$ npm install simple-proxy
npm WARN package.json docco#0.6.2 No repository field.
npm http GET https://registry.npmjs.org/simple-proxy
npm http GET https://registry.npmjs.org/simple-proxy
npm http GET https://registry.npmjs.org/simple-proxy
npm ERR! network socket hang up
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is 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'
npm ERR! System Linux 3.5.0-17-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "simple-proxy"
npm ERR! cwd /home/nasser/projects/serverV3
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! code ECONNRESET
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/nasser/projects/serverV3/npm-debug.log
npm ERR! not ok code 0
i had same problem.
it seems that there is some problem with ISP's https handling. doing:
npm config set registry http://registry.npmjs.org/
worked for me
I was having the same problem. Found a solution in this thread.
You can see the effective proxy that npm is using by doing:
npm config get proxy
npm config get https-proxy
If you're behinid a proxy, try this:
mv ~/.npmrc ~/.npmrc.bak
I was having a similar issue with my windows machine and i fixed it by first checking whether my proxy got some value by executing the below command.
npm config get proxy
in return i got the below:
http://usr:pwd#host/:port
So if anyone who is not under a proxy layer first set the proxy as null by executing the below command.
npm config set proxy null
now if you excecute your npm i it should not throw any network error.
I tried multiple solution but most of cases happened with me is network/ssl and proxy issue.Network/ssl cases are very common and there are bunch of solution but with proxy thing I shared my fixes with you.
Bash Commands:
npm config set proxy null
npm config set https-proxy null
npm config set http-proxy null
in my case I'm using https://registry.npmjs.org/ url.
After NULL proxy its start working.
npm set default proxy as http://my-proxy.com:1080/ so either we have to change proxy url or null it.
To get your default proxy hit below command in your bash.
npm config get proxy
If you are behind a proxy that has username and password authentication, try setting the proxy as
npm config set proxy http://username:encodedpassword#proxyaddress:port
npm config set https-proxy http://username:encodedpassword#proxyaddress:port
Just follow these steps before you run: npm install -g #angular/cli
npm cache clean (You can even ignore if it throws an error)
npm config set strict-ssl false
npm config set proxy http://myusername:mypassword#proxyaddress:port
npm config set https-proxy http://myusername:mypassword#proxyaddress:port
Add the proxy and http_proxy field with your credentials (encoded if it contains any special characters) to your .npmrc file and run npm install again. It should work.
for example:
proxy=http://username:passcode#proxyURL:80/
https_proxy=http://username:passcode#proxyURL:80
Find .npmrc file, open with note pad. then delete the proxy setting there

Resources