Can't delete npm proxy - proxy

In work I have a proxy and set this in npm
npm config set proxy http://theproxy:8080
npm config set https-proxy https://theproxy:8080
Out of work I don't have the proxy and need to remove it in npm.
I've tried
npm config rm proxy
npm config rm https-proxy
and
npm config delete proxy
npm config delete https-proxy
but when I use
npm config get proxy
npm config get https-proxy
the proxy is still there
How do I remove the proxy in npm

Below things worked for me, make sure environment variable HTTP_PROXY is unset before removing config entries
Unsetting HTTP_PROXY= is very important
set HTTP_PROXY=
npm config rm proxy
npm config rm https-proxy
npm config rm http-proxy

It works very well for me ..
saidas-mbp:trunk saidababuchanda$ npm config set proxy https://www.google.com
saidas-mbp:trunk saidababuchanda$ npm config get proxy
https://www.google.com
saidas-mbp:trunk saidababuchanda$ npm config delete proxy
saidas-mbp:trunk saidababuchanda$
saidas-mbp:trunk saidababuchanda$ npm config get proxy
null
saidas-mbp:trunk saidababuchanda$ npm -v
1.4.14
saidas-mbp:trunk saidababuchanda$
Please look at your npm version

Try this
npm config delete proxy
npm config delete proxy -g
npm config delete https-proxy
npm config delete https-proxy -g

In my case the issue was trying to delete the proxy while I was in specific folder project that contains .npmrc file.
Inside the file there was proxy definition for this specific folder.
So I removed the proxy definition inside.

I doubt , it is set somewhere in your npmrc files , can you check below files?to see if this value is set somewhere.
npmrc Files
The four relevant files are:
per-project config file (/path/to/my/project/.npmrc)
per-user config file (~/.npmrc)
global config file ($PREFIX/npmrc)
npm builtin config file (/path/to/npm/npmrc)

npm config rm proxy
npm config rm https-proxy
npm config rm http-proxy

I think your issue is you need to remove it globally. Try:
npm config rm proxy -g
npm config rm https-proxy -g

Three steps solution.
What worked for me is setting the proxy to an empty string / url, then I used npm config delete to remove the https-proxy setting.
So i ran the following commands:
npm config set proxy
npm config delete https-proxy -g
Additionally you can run npm config list to verify that the values indeed have been removed.
Now one last thing, you need to run the following command:
npm config edit
A file will open on your default text editor, in that file remove any proxy configurations added by you.

I tried all the solutions in this thread but it didn't work. The issue was that proxy settings were commented in my "C:\Users\YOURNAME.npmrc" file. Uncommenting it worked for me.
proxy=null
https-proxy=null

Related

Can't run npm commands behind a proxy

I'm using npm behind a proxy which doesn't requires username and password, I've tried all different commands but without any result, the internet connection is working fine on command line , here's is the command I've used :
- npm config set proxy http://10.23.201.11:3128
- npm config set https-proxy http://10.23.201.11:3128
- npm config set registry https://registry.npmjs.org/
- npm config set strict-ssl false
- npm config set bin-links false
** These are the errors I'm getting when trying to run an npm command :
example : npm install -g react-native-cli
- npm rollback failed
- npm ERR! code E502
- 502 Bad Gateway: react-native-cli#latest

Thingsboard Not building from Source

I have a new ubuntu 16.04 Virtual machine that I'm attempting to install thingsboard on using this documentation Contribution Guide and am not having any success:
This is what did did on the machine:
sudo apt-get install default-jre default-jdk
Export JAVA_HOME='/usr/lib/jvm/default-java'
git clone https://github.com/thingsboard/thingsboard.git
git checkout release-1.3
cd ${TB_WORK_DIR}/application
mvn clean install -DskipTests
Modified cd ${TB_WORK_DIR}/application/target/bin/install/install_dev_db.sh to my user and executed script.
I would like to use HSQLDB at the moment.
cd ${TB_WORK_DIR}/application
mvn clean install -DskipTests
Results:
NPM server starts but when I log onto localhost:3000 and attempt to login with tenant#thingsboard.org / tenant, I get the error
[Error API proxy error: Error connect ECONNREFUSED 127.0.0.1:8080]
I've triple checked that I do not have a typo.
Am I missing a step?
I'm not using a proxy and received the same error as above:
npm config set proxy null
npm config set https-proxy null npm config
npm config set registry http://registry.npmjs.org/
cat ~/.npmrc:
proxy=null
https-proxy=null
registry=http://registry.npmjs.org/ls
As you noted, this is the same as thingsboard/thingsboard issue 336...
with the only tip being:
I think you need the backend running in order to be able to log in.
Either you are behind a proxy
npm config set proxy http://myproxyblabla:myport
npm config set https-proxy http://myproxyblabla:myport
Or you are not, meaning your localhost thingsboard system should not use a proxy at all:
npm config set proxy null
npm config set https-proxy null
In both cases:
npm config set registry http://registry.npmjs.org/
Then try again to re-start your server and to log on.
Try this
1- make sure you have java 8 (JDK not JRE) ,
2- Run "mvn clean install -DskipTests" from root directory (not application directory)
3- hit 127.0.0.1:8080 not :3000 (this one if you build from UI folder)

Getting ETimedOut error when trying to install packages using npm in windows

I'm facing this "ETimedOut" error when trying to use this command "npm install -g yo" .Actually I'm using a network proxy to access internet.
I got a warning message that "If u are behind a proxy,please make sure that 'proxy' config is set properly ".
Can anyone please help me out regarding this issue.
You can set the npm proxy config parameter using these commands:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
Source

ETIMEDOUT Error while installing Node packages on Windows

I am trying to install node packages on my windows machine using npm from a fresh install of node.
however, I am getting ETIMEDOUT errors. I checked few other stackoverflow questions with similar problem and almost all of them are related to problems when behind a proxy. Same is not the case with me. My system is not behind any proxy server. Can someone help me with resolving it.
PS C:\windows\system32> npm -v
2.5.1
PS C:\windows\system32> npm install bower -g
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i
nstall" "bower" "-g"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect
npm ERR! network connect ETIMEDOUT
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! Please include the following file with any support request:
npm ERR! C:\windows\system32\npm-debug.log
I am posting this answer in case some one faces the same issue.
I was able to solve this by running following command:
npm config delete proxy
First, run
npm config list
and check whether you are behind a proxy. If so, try running
npm config delete proxy
npm config delete http-proxy
npm config delete https-proxy
as required
**If this method did not work, reinstall nodejs.
I tried all the suggested solutions I could find on GitHub forums and StackOverflow topics. Finally disabling my router's firewall solved the issue immediately.
I am using Windows 10, node 4.0.0 and npm 2.13.4.
First see the npm config list:
npm config list
If you don't find http-proxy, https-proxy and proxy correctly set, then
You need to configure npm to work with your web proxy. For example:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
npm config set http-proxy http://proxy.company.com:8080
Not on Windows but it can help there as well.
Node 16 worked, Node 18 did not. Turns out it was related to IPv6. As soon as I disabled IPv6 the connection did not timeout any more. The target registry was a Nexus server.
You can try to throttle the number of simultaneous connections with the following command (for example 3 maximum simultaneous connections):
npm set maxsockets 3
The CLI has been allowing this option since npm#3.8.0. The default is 50 simultaneous connections max. See this link for further reference.
If removing the npm proxy config settings (or correctly setting them, if that is necessary for you) did not fix it, then This github issue discusses what might be happening. My summary is that for some reason the ipv6 dns resolution to the registry is not resolving correctly and seems to be randomly failing for people.
My command was fetching from registry.npmjs.org using npm 9.1.2 and node 18.12.1 - I was running this from a windows terminal via vscode.
I ended up disabling ipv6 via the network properties of my adapter see here
Again, changing the npm config proxy settings did not resolve anything for me. I re-enabled ipv6 after my command finished.
For people working in corporates (where you cannot delete or edit the proxy configuration of the organization):
There must be an .npmrc file in your users folder. If not, you can create one. This file can be edited to register the proxy settings of your organization. Contact your organization's IT team to get the relevant proxy details.
Example of the .npmrcfile contents for my organization:
strict-ssl=false
registry=https://nexus.com/nexus/content/groups/npm-read/
proxy=http://primary-proxy.gslb.intranet.com:8080/
https-proxy=http://primary-proxy.gslb.intranet.com:8080
This file can be found in your users folder:
I was not able to install any packages before because of this error then after 1 hour, I finally resolved it because I was not behind a proxy but the proxy parameters got set in the npm config thats why that error was showing.
I'am posting it because if anyone is facing the same issue and if they are not behind any proxy then they can use the following commands:-
npm config rm proxy
npm config rm https-proxy
npm config delete http-proxy
npm config delete https-proxy
set HTTP_PROXY=null
set HTTPS_PROXY=null
One way to resolve this is to set Fiddler as your proxy server. This probably only works for windows.
Running Fiddler, type these commands:
npm config set proxy http://localhost:8888
npm config set https-proxy http://localhost:8888
Before you do this, Rules -> Automatically Authenticate
I solved with:
npm config set proxy null
I solved it with the following:
npm config rm proxy
npm config rm https-proxy
npm config delete http-proxy
npm config delete https-proxy
set HTTP_PROXY=null
set HTTPS_PROXY=null
I was going through the same error. the root cause was the proxy settings : there are several answers provided in here to reset the proxy but none of them worked for me.
Below commands solved my problem, give them a try.
npm config rm proxy
npm config rm https-proxy
If none of the mention solutions works for you then, try switching your node version.
I tried to implement all solutions and suggested commands for npm and yarn but it's not resolved.
When I disable my VPN and try to "yarn install, " it will work fine.
After all the effort with no result, I reboot my router and it works!
On windows 10, adding Node.js to the firewall authorized applications AND restarting the laptop solved the problem.
I also face this issue
Solution
Just uninstall Node.js .
uninstall its package also which you downloaded from website.
Download Node.js from website.
Reinstall Node.js .
It will Work.

nodejs npm global config missing on windows

I can't find at all where npm has its global settings stored.
npm config get userconfig
C:\Users\Jack\.npmrc
npm config get globalconfig
C:\Users\Jack\AppData\Roaming\npm\etc\npmrc
There's no files at either of these paths and yet
npm config get proxy
-> returns my proxy url for work. which I want to delete.
npm config -g delete proxy
npm ERR! Error: ENOENT, unlink 'C:\Users\Jack\AppData\Roaming\npm\etc\npmrc'
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "config" "-g" "delete" "proxy"
npm ERR! cwd C:\f\Dropbox\apps
npm ERR! node -v v0.8.22
npm ERR! npm -v 1.2.14
npm ERR! path C:\Users\Jack\AppData\Roaming\npm\etc\npmrc
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\f\Dropbox\apps\npm-debug.log
npm ERR! not ok code 0
There is a problem with upgrading npm under Windows. The inital install done as part of the nodejs install using an msi package will create an npmrc file:
C:\Program Files\nodejs\node_modules\npm\npmrc
when you update npm using:
npm install -g npm#latest
it will install the new version in:
C:\Users\Jack\AppData\Roaming\npm
assuming that your name is Jack, which is %APPDATA%\npm.
The new install does not include an npmrc file and without it the global root directory will be based on where node was run from, hence it is C:\Program Files\nodejs\node_modules
You can check this by running:
npm root -g
This will not work as npm does not have permission to write into the "Program Files" directory. You need to copy the npmrc file from the original install into the new install. By default the file only has the line below:
prefix=${APPDATA}\npm
For me (being on Windows 10) the npmrc file was located in:
%USERPROFILE%\.npmrc
Tested with:
npm v4.2.0
Node.js v7.8.0
It looks like the files npm uses to edit its config files are not created on a clean install, as npm has a default option for each one. This is why you can still get options with npm config get <option>: having those files only overrides the defaults, it doesn't create the options from scratch.
I had never touched my npm config stuff before today, even though I had had it for months now. None of the files were there yet, such as ~/.npmrc (on a Windows 8.1 machine with Git Bash), yet I could run npm config get <something> and, if it was a correct npm option, it returned a value. When I ran npm config set <option> <value>, the file ~/.npmrc seemed to be created automatically, with the option & its value as the only non-commented-out line.
As for deleting options, it looks like this just sets the value back to the default value, or does nothing if that option was never set or was unset & never reset. Additionally, if that option is the only explicitly set option, it looks like ~/.npmrc is deleted, too, and recreated if you set anything else later.
In your case (assuming it is still the same over a year later), it looks like you never set the proxy option in npm. Therefore, as npm's config help page says, it is set to whatever your http_proxy (case-insensitive) environment variable is. This means there is nothing to delete, unless you want to "delete" your HTTP proxy, although you could set the option or environment variable to something else and hope neither breaks your set-up somehow.
How to figure it out
Start with npm root -- it will show you the root folder for NPM packages for the current user.
Add -g and you get a global folder. Don't forget to substract node_modules.
Use npm config / npm config -g and check that it'd create you a new .npmrc / npmrc file for you.
Tested on Windows 10 Pro, NPM v.6.4.1:
Global NPM config
C:\Users\%username%\AppData\Roaming\npm\etc\npmrc
Per-user NPM config
C:\Users\%username%\.npmrc
Built-in NPM config
C:\Program Files\nodejs\node_modules\npm\npmrc
References:
https://docs.npmjs.com/files/npmrc
https://docs.npmjs.com/misc/config
https://docs.npmjs.com/cli/root.html
Have you tried running npm config list? And, if you want to see the defaults, run npm config ls -l.
Even though we have the .NPMRC can be in 3 locations,
Please NOTE THAT - the file under the Per-User NPM config location take precedence over the Global & Built-in configurations.
Global NPM config => C:\Users\%username%\AppData\Roaming\npm\etc\npmrc
Per-user NPM config => C:\Users\%username%.npmrc
Built-in NPM config => C:\Program Files\nodejs\node_modules\npm\npmrc
To find out which file is getting updated, try setting the proxy using the following command
npm config set https-proxy https://username:password#proxy.company.com:6050
After that open the .npmrc files to see which file get updated.
Isn't this the path you are looking for?
C:\Program Files\nodejs\node_modules\npm\npmrc
I know that npm outputs that , but the global folder is the folder where node.js is installed and all the modules are.
On windows, used the below command that listed down all the default values for npm including the location of config file with variable name userconfig
npm config ls -l

Resources