npm running task rollbackFailedOptional forever - npm

I'm trying to install a new package via npm. Something like this:
npm install -g connection-test
Sadly the console is never finishing the task "rollbackFailedOptional".
I'm behind a proxy which I added to the npm config.
I removed the s from the https of my registry.
Any ideas what could be the issue or how to resolve this?

I made a mistake in the configuration. Didn't put the https:// in front of the Ip-address of the proxy.

Related

Error 403 - Forbidden while trying npm install

So just like every day I do different projects and install additional modules, today I want to install another module and such an error, reinstall the server and still the same .... [Error]The error appeared overnight
I found the issue from here: https://github.com/npm/npm/issues/2119#issuecomment-5321857
It's a very common issue in npm. Actually npm is not working good with HTTPS over a proxy. Changing the registry URL from HTTPS to HTTP will fix the problem.
Try this out:
npm config set registry http://registry.npmjs.org

Cannot login into Verdaccio

I have just installed Verdaccio on my computer. I have changed nothing in the config file, apart from adding proxy_related info:
http_proxy: http://proxy.ip:8080
https_proxy: https://proxy.ip:8080
no_proxy: localhost,127.0.0.1
After starting the process, I have tried to login to the registry from the library project workspace
npm adduser --registry http://localhost:4873
But I get this error:
npm ERR! 503 Service Unavailable - POST http://localhost:4873/-/v1/login
If I try to reach http://localhost:4873/ from my browser, I can see the Verdaccio webpage.
What am I doing wrong?
I don't know what kind of environment you are trying this (work, home, etc.) but, for me, my problem was that behind a corporate firewall I have to configure the NPM proxy (http and https), so adding the localhost as an exception to noproxy config attribute of NPM, it worked for me.
npm config set noproxy localhost
Try to change yours, from no_proxy to noproxy, maybe it is simple as that.

How to fix timeout for packages on `npm install`?

When I run npm install it seems to work fine until part way installing packages. It seems to have no problem with the first half, but then after a while it will fail to be able to reach other packages. I just get the repeating errors, eg:
npm http request GET https://registry.npmjs.org/react-hot-loader
npm info attempt registry request try #3 at 6:43:34 AM
npm http request GET https://registry.npmjs.org/react-tap-event-plugin
npm info attempt registry request try #3 at 6:43:34 AM
npm http request GET https://registry.npmjs.org/react-test-renderer
etc.
It will continue to do this for an hour and and then the install will fail.
The install breaks at a different package each time so I don't think it's a problem with a particular file.
I can access these files fine with my browser and curl.
My work has a firewall but this domain is whitelisted.
Would anyone know what I could do to get this to work or what could be causing it?
If it's about the timing problem you should find a speed solutions for npm install.
So you can try these faster command than npm install :
pnpm install %70 faster
or
npm install --no-audit 15% faster
or
npm install --prefer-offline --no-audit 15% faster
check this article for details : speeding up npm install
You can override the max and min timeout in ~/.npmrc.
// npm config ls -l
// add these 2 lines in ~/.npmrc
fetch-retry-maxtimeout = 6000000
fetch-retry-mintimeout = 1000000
If your internet connection is the problem, try increasing the timeout:
npm config set timeout 6000000
The value is a 32-bit int.
If it's still relevant or maybe for other people of interest: For me it helped, deleting the package.lock file and running npm cache clean --force.
It might not be your case, but I had issues with a package being hosted at github with the repo url being only with git protocol (port 9418 not usually open on firewall).
Once added that to the firewall I could npm install without issues.
You can view the repository url with:
$ npm view zone.js repository.url
git://github.com/angular/angular.git
I saw an answer earlier that can resolve your problem by overriding the max and min timeout in ~/.npmrc file, but some didn't understand how to do it.
First go to the nodejs folder - for me it's located at ( Y:\Program Files\nodejs )
Open the node_modules folder.
Then npm folder.
Select (.npmrc) file + right click and open it with any text editor you want.
Finally add these 2 lines and click Ctrl+S
fetch-retry-maxtimeout = 6000000
fetch-retry-mintimeout = 1000000
.npmrc file after modification
npm cache clean --force
npm install --force
It works fine.
If you are on windows, try running vscode as administrator, it worked for me, I tried npm config delete https-proxy , npm config delete proxy and , tried deleting node_modules, and package.lock.json and ran npm cache clean --force but at last ran vscode as adminitrator before deleting node_modules and package.lock.json, it worked
I solved the timeout issue by executing these commands:
rm package-lock.json
npm i

How to install files using npm behind proxy?

While running the npm install command, I'm getting:
ERR 418 I m a teapot
I set a proxy but I'm not sure whether it is correctly parsed. I doubt that the proxy might be the reason. Can someone help me on this? I also ran npm config get proxy.
Try something like this:
npm config set proxy 213.169.158.34:8080
npm config set https-proxy 213.169.158.34:443
npm config set registry http://registry.npmjs.org/
npm instal

Cannot install some packages from npm

My computer has a strange problem. Whenever I try to install some npm packages like ionic and cordova, it fails giving some shasum check failed error.
Like this cmd snapshot:
This has happened with other packages like generator-ionic
I've also checked for proxy setups in Internet Options and Router Settings, there are none.
Also, when I try to install these packages using my phone's data connection (usb tethering) they get installed without any problems.
I am assuming there is some problem with my internet connection, but can't seem to figure out what it is.
If your network is blocking the npm repository ,You may get this error ,Please use fiddler to debug you npm is able to connect to repository