Npm Error: 503 Service Unavailable for npm install command - node.js

Im trying to run npm install command but i got this error Error: 503 Service Unavailable for npm install command, Can any one please im requesting you to solve this one.
This is actual complete error im getting on error log file
3413 verbose stack Error: 503 Service Unavailable - GET http://52.169.74.37:8081/repository/npm-private/#ctc%2fctc-pubsub-common
3413 verbose stack at res.buffer.catch.then.body (C:\node\node_modules\npm\node_modules\npm-registry-fetch\check-response.js:104:15)
3413 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
3414 verbose statusCode 503
3415 verbose pkgid #ctc/ctc-pubsub-common#^1.0.5
3416 verbose cwd C:\Users\vktest\pro
3417 verbose Windows_NT 10.0.15063
3418 verbose argv "C:\\node\\node.exe" "C:\\node\\node_modules\\npm\\bin\\npm-cli.js" "install"
3419 verbose node v10.16.3
3420 verbose npm v6.9.0
3421 error code E503
3422 error 503 Service Unavailable - GET http://52.169.74.37:8081/repository/npm-private/#ctc%2fctc-pubsub-common
3423 verbose exit [ 1, true ]

Seems like your npm registry config pointing to some private registry that is down or unavailable.
Try to check npm configuration :
npm config get registry
It should be like :
http://52.169.74.37:8081
So update the config which will point to offical registry.
npm config set registry https://registry.npmjs.com/

You may try to set these parameters:
npm config set proxy "http://proxy.url:port/"
npm config set https-proxy "http://proxy.url:port/"
npm config set strict-ssl false
npm config set registry "https://registry.npmjs.org/"

Sometimes (but it's rare) it's because the npm services are down. You can check npm services status on their website : status.npmjs.org

There is a good explanation of issue and solution
NPM Error "failed to fetch from registry" when Installing Module
Old/Buggy NPM Version
As you might have noticed from the error message above, the npm version being used is pretty old. In this example we were using Node v0.6.10 and npm v1.1.0-3. This version is known to have some problems with Ubuntu 12.04, so your best bet is to update Node (and npm along with it) to the newest version:
$ sudo npm update npm -g
If you want to re-install completely, you'll first want to completely remove the current Node/npm executables:
$ sudo apt-get purge nodejs npm
Then re-install using a more updated version, like from Nodesource:
$ curl -sL https://deb.nodesource.com/setup | sudo bash -
$ sudo apt-get install -y nodejs
Or, even better, you can check out this article for a more thorough guide to installing Node.js on Ubuntu.
Can't Download Over HTTPS
For one reason or another, some people can't connect to the registry via HTTPS. This can be fixed by setting the registry to use HTTP instead:
$ npm config set registry http://registry.npmjs.org/
$ npm config set strict-ssl false
This isn't recommended, however, since your packages will then be downloaded insecurely. It would be best to find the actual root cause instead of using a work-around like this.
Corporate Proxy
For many people, the root cause is actually because a proxy is being used on their network. If this is the case, you can use the following commands to set the HTTP and HTTPS proxies:
$ npm config set proxy http://user:password#proxy.example.com:8181
$ npm config set https-proxy http://user:password#proxy.example.com:8181
This will save the new configurations and should allow you to access the internet with npm.

try using local npm looks like service not available in your country
https://www.npmjs.com/package/local-npm

Try this one, In my case, it worked.
npm --registry http://registry.npmjs.eu/ install karma

I have a same problem with the publish.
first, I remove proxy and https-proxy config with this command:
npm config delete proxy
npm config delete https-proxy
then I publish my package with this command:
npm publish
I hope is useful.

In my case the NO_PROXY variable was missing, but HTTP_PROXY was set. NPM tried to go over the proxy, which was wrong in my case.
I declared the npm config variable noproxy (without underscore)
npm set noproxy "localhost,.mydomain.de"
Alternately one can set the environment variable NO_PROXY (with underscore)
SET NO_PROXY=localhost,.mydomain.de
ATTENTION: npm doesn't understand "*" (*.mydomain.de would be wrong) and multiple servers must be separated by "," (not semicolon).
Tested with Windows 10 and nodejs16 (npm 8.19.2) und nodejs19 (npm 8.19.3)

You can try typing this;
npm install

Related

npm install shows 403 Error on Ubuntu on Windows 10 behind proxy

I'm using ubuntu on Windows 10 to install and run npm.
I downloaded nodejs using:
curl -sL https://deb.nodesource.com/setup_10.x | bash
apt-get install -yq nodejs
I set my proxy parameters using:
npm config set proxy http://my.domain.name:port
npm config set https-proxy http://my.domain.name:port
When doing npm install I get the following error:
...
npm ERR! code E403
npm ERR! 403 Forbidden - GET https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz
npm ERR! A complete log of this run can be found in:
...
I've checked similar posts but without any success:
Using npm behind corporate proxy .pac
npm behind a proxy fails with status 403
Please let me know if you have any idea on this one, best
try this
export https_proxy=http://my.domain.name:port
export http_proxy=http://my.domain.name:port
Finally managed to solve my problem. The proxy settings defined by our admin didn't allow connections to https://registry.npmjs.org/. I had to define an exception to that particular address in my windows 10 proxy settings.
Thanks for your help

npm rollbackFailedOptional error when install any package

I have a problem when installing any npm packages. here is my error:
rollbackFailedOptional: verb npm-session xxxxxxxxxxx
for resolving this I do some stuff but I still get the same error.
I put registry=http://registry.npmjs.org/ in .npmrc file in my user folder and also run following commands:
npm config rm proxy
npm config rm https-proxy
I try to solve the problem in node 8.11.1 and node 10.1.0 and my npm version is 5.6.0.
Why this problem occurs and how can resolve that?
Update:
npm config list:
; cli configs
metrics-registry = "http://registry.npmjs.org/"
scope = ""
user-agent = "npm/5.6.0 node/v8.11.1 win32 x64"
; userconfig C:\Users\me\.npmrc
https-proxy = "https://username:password#proxy.company.com:6050/"
proxy = "http://username:password#proxy.company.com:6050/"
registry = "http://registry.npmjs.org/"
; builtin config undefined
prefix = "C:\\Users\\me\\AppData\\Roaming\\npm"
; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\me
; HOME = C:\Users\me
; "npm config ls -l" to show all defaults.
Can you try enter this and then re run:
npm config set registry http://registry.npmjs.org/
I've tried almost all methods posted in various forums like stackoverflow, github-issues etc.. but nothing seemed to work.
Here are the commands I've executed in order which I encourage you to try because it worked for many people (but not me):
npm config rm proxy
npm config rm https-proxy
npm config set https-proxy https://username:password#proxy.company.com:6050
npm config set proxy http://username:password#proxy.company.com:6050
npm config set registry http://registry.npmjs.org/
And then when trying to install the package npm install -g express - it failed.
However, when I tried to run npm install npm#latest -g it miraculously executed and installed fine!
Then running npm install -g express again worked perfectly fine too.
TL;DR: updating npm to the latest version solved the issue (currently 6.0.1)
I am installing npm package behind corporate proxy. following steps resolved the issue for me -
Remove http and https proxy - npm config rm proxy and npm config rm https-proxy
Set registry - npm config set registry http://registry.npmjs.org/
Set http and https proxy - npm config set proxy yourCorporateProxyAddress:port ,
npm config set https-proxy yourCorporateProxyAddress:port
Install package - npm install packageName
I solved this problem by setting the proxy property of config.
The most likely reason you might be facing this problem is if you are behind a proxy.
You may follow the following steps to solve the issue
Type:
npm config get proxy
If you get null. It means the proxy is not set.
Go to Internet Explorer->Tools->Internet Options-> LAN Settings
Here you would find your proxy address and port under proxy server. If you have your username and password then do the following
npm config set proxy http://your-username:your-password#Proxy-address:port-number
After this you can use npm install.
I was getting same error in user command prompt then tried in PowerShell as an admin and it worked.
Run the following commands in Windows PowerShell as Administrator:
npm config set https-proxy https://username:password#proxy.company.com:6050
npm config set proxy http://username:password#proxy.company.com:6050
config set registry http://registry.npmjs.org/
I had resolved this identical issue by pointing the npm to the correct proxy when using a corporate machine. NO ADMIN REQUIRED!!!
Here are my steps:
Obtain the correct proxy by following these steps here! Copy/paste the proxy address into notepad. You will use this same proxy to set both the 'proxy' and 'proxy-https' params in the next step.
Execute the following 2 commands in your command window by replacing <contents> below with proxy address obtained in previous step:
npm config set proxy http://<proxy-server-url:port>
npm config set https-proxy http://<proxy-server-url:port>
NOTE: I ommitted 'username' and 'password' fields from the 'http://<username><password>#<proxy-server-url:port>' template which according to the source should work 9 out of 10 times, and worked perfectly for me.
Navigate to your project folder from the command line and execute 'npm install <package name(s)>'. The installation should be successfull.
first this
npm config rm proxy
npm config rm https-proxy
then this
npm config set registry https://registry.npmjs.org/
then Install package
npm install packageName
PS: be sure to check if your internet connection is correct.
I had the same issue!
Reinstalling the latest 32-bit nodejs worked for me.
Just to note, I don't have any proxy on my network. Sometimes, when I have this problem I reconnect to my wifi, which also works sometimes.
I had the same issue while trying to install from Github. The issues was because of bad usage of the scripts in package.json and their hooks.
I had same problem trying to install any npm package.
Solved by adding some proxy config
Go to Users->"yourUser"-> Open .npmrc with a text editor -> add those two lines
https-proxy=http://username:password#proxyUrl:port/
proxy=http://username:password#proxyUrl:port
Modify username and password, setting your user information.
Modify proxyUrl and port according to your needs
That worked for me!

NPM error install angular 2 CLI : tunneling socket could not be established, statusCode=405

When i installed angular 2 cli I get an error with the NPM :
Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-48_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-48_binding.node":
tunneling socket could not be established, statusCode=405
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
node -v : 6.9.4,
npm -v :3.10.10
I don't use proxy. I have done few things like :
npm config rm proxy
npm config rm https-proxy
npm config set proxy false
npm cache clean
npm config set registry "https://registry.npmjs.org/"
but not working, I also have searched stackoverflow for few days, I don't get a solution, thank you..
HI I was facing the same issue and i did following configuration change.
Execute following commands in command prompt.
npm config set proxy null
npm config set https-proxy null
Hope it help you as well.

Failed to install dependencies when npm install hexo-cli -g

when I run npm install hexo-cli -g in git bash terminal in my computer, I experience a network proxy issue as shown by image below:
code in the git bash
Seems like your computer is behind a proxy/firewall. If you configure the proxy correctly it might work. Try this:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
Don´t forget to change proxy.company.com:8080 with values from your proxy (you can find it in your Internet Explorer network configuration). More information can be found here
If this don´t help, please, provide us the npm-debug.log file.

phantomjs npm install fails behind proxy

Trying to install PhantomJS via an npm wrapper while behind the corporate proxy. I had already set the http_proxy and https_proxy environment variables so that npm itself would be able to communicate with the registry:
export http_proxy=my-company-proxy.com:80
export https_proxy=my-company-proxy.com:80
But when it came to the node install.js stage of phantomjs, I got a Protocol not supported error:
http.js:1711
throw new Error('Protocol:' + options.protocol + ' not supported.');
^
Error: Protocol:my-company-proxy.com: not supported.
The problem was that the phantomjs npm wrapper code assumes that the proxy info is a complete url, not just a hostname. This resolves the issue:
export http_proxy=http://my-company-proxy.com:80
export https_proxy=http://my-company-proxy.com:80
npm, git, etc work fine with either format, but for this particular package it needs HTTP_PROXY to have a full URL.
UPDATE: this related issue has been resolved and now it can use the same configuration system as npm itself (e.g. if you used npm config command) rather than relying on environment variable.
This is what worked for me.
Open the terminal as an administrator
Navigate to your project folder and enter the following commands
sudo npm config set proxy http://proxy_host:port -g then
sudo npm config set https-proxy http://proxy_host:port -g
Hope this works for you. Good luck.

Resources