npm install failing with proxy authentication required despite noproxy being set - npm

I have an issue with npm install. I have configured npm to use my company's registry and configured the proxy to get external dependencies and set noproxy for my company's intranet.
noproxy = "*.intra.company.fr"
proxy = "http://user:pass#proxy.intra.company.fr:8080/"
registry = "http://registry.subdomain.intra.company.fr/repository/npm/"
However, when I try to install my project, I get this error:
npm ERR! code E407
npm ERR! 407 Proxy Authentication Required - GET http://registry.subdomain.intra.company.fr/repository/npm/#babel/types/-/types-7.15.0.tgz
I checked, I have no system environment variables set for HTTP_PROXY, PROXY or NO_PROXY.
Edit: npm version is 6.14.15

What's your NPM version ? you should be able to set noproxy on a domain wih NPM 6.4.1+ with a custom registry configured.
npm config set noproxy "*.intra.company.fr"
But maybe there is an issue with *, can you try to set your noproxy with your private registry ?
noproxy = "registry.subdomain.intra.company.fr"
You could also try to manually change your config in .npmrc.
By default, the value of noproxy is taken from the no_proxy environment variable. Try to use it to fix your issue.
export no_proxy="intra.company.fr"

Related

List of npm registry

I want list of npm registries. I cannot install npm packages from https://registry.npmjs.org/, registry http://r.cnpmjs.org, http://registry.npmjs.eu, https://registry.npm.taobao.org/. They are all blocked. If you have any idea please make me aware of how can i install packages
Why its blocked?
maybe the right solution will be to use proxy like that (use your proxy its just an example)
npm config set proxy http://proxy.com:8000
or
npm config set https-proxy http://proxy.com:8000

Cannot load a package using NPM - local certificate error

Apologies if this is a repeat question, but I am new to this. I have installed nodeJS and am trying to install hardhat. I have a Windows 10 laptop.
I followed the instructions here: https://hardhat.org/tutorial/setting-up-the-environment
I am trying to run the following code:
mkdir hardhat-tutorial
cd hardhat-tutorial
npm init --yes
npm install --save-dev hardhat
Then I get the following errors:
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/hardhat failed, reason: unable to get local issuer certificate
When I search this online it says to try the following solutions:
npm config set strict-ssl false
OR
npm config set registry http://registry.npmjs.org/
I've done both and rebooted the PC and it doesn't make a difference. Anyone got any ideas of what I can do to resolve this?
Thanks
John
You are running from behind a "deep inspection" web proxy, which issues fake SSL certificates to allow it to inspect your traffic, and although there are probably automated systems to make your browser trust the root CA cert that issues these certificates, npm is not configured to trust that CA.
You should be able to get the CA cert from your browser, the system keychain, or your IT department, and then configure npm to use it with npm config set cafile /path/to/cert.pem
even if you don't know where the corporate certificate is located you can solve it for a single terminal use by running set NODE_TLS_REJECT_UNAUTHORIZED=0 before running the npm commands it will work for the current terminal session.
or you can run setX NODE_TLS_REJECT_UNAUTHORIZED 0 /m once
beware this option as security risks!
to cancel this setting you should run REG delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /F /V NODE_TLS_REJECT_UNAUTHORIZED .
the best way to solve the problem will be to find the corporate certificate and run the following command SetX NODE_EXTRA_CA_CERTS "path/to/certificate" /m when you change path/to/certificate by the full path.
Turning off strict ssl: npm config set strict-ssl=false
Changing the registry to http instead of https: npm config set registry http://registry.npmjs.org/
Changing my cafile setting: npm config set cafile /path/to/your/cert.pem
Stop rejecting unknown CAs: set NODE_TLS_REJECT_UNAUTHORIZED=0

Configure npm install proxy

I want to configure node so that I can download packages using npm install knowing that I am inside a company with a proxy.
I tried commands like :
npm config set https-proxy "http://company%5Cuser:password#server:port/"
but nothing changes.
Did I miss something?
Try to also set the http proxy:
npm config set proxy "http://company%5Cuser:password#server:port/"
Using CNTLM proxy had spared me those configs.

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

create-react-app-typescript failed with Proxy Authentication required error while creating app

I am working in corporate premise. I am trying to create react app with typescript but it failed with below error:
D:\learning\reactjs>create-react-app my-app --scripts-version=react-scripts-ts
Creating a new React app in D:\learning\reactjs\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripemphasized textts-ts...
npm ERR! code E407
npm ERR! 407 Proxy Authentication Required: react-scripts-ts#latest
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\kalpanap\AppData\Roaming\npm-cache_logs\2018-02-21T02_33_17_410Z-debug.log
Aborting installation.
*npm install --save --save-exact --loglevel error react react-dom react-**scripts-ts has failed.*
Deleting generated file... package.json
Deleting my-app / from D:\learning\reactjs
Can anyone help to fix this problem?
Even I have updated npm config proxy and https-proxy to office n/w proxy. After this change only I was able to successfully run the npm install command.
How can I create-react-app with passing proxy parameters?
Thanks in advance
Your company's proxy must be not allowing you to access the setup.
Use the following two commands from command-promt
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
In place of "proxy.company.com", use your proxy address that you are using.
You can find your proxy at
IE Browser -> Internet Options -> Connections tab -> LAN Settings.