You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No, it works with the change I posted.
I managed to install nodejs 14/16/18/19 and use them without any problem (after declaring my proxy of course when needed)
The proxy my enterprise uses is a filtering one.... only dns declared are allowed.
I did, it works now BUT I have to tell curl and git to use the proxy.... thus the issue I posted
There's no option in nvm to tell it to use a proxy right now...
I'd really like if telling my company that was a possibility but that's the problem... most company put these type of restriction with the aim to limit access to external network, so no, that's not an option sadly...
I don't want to use a sock proxy because depending of what resource I need to access, I'm using various proxy or vpn depending of the use case.
But if you look at what I did, getting nvm to work with proxy seems pretty easy:
for the install part, we'd simply need to tell curl to use the proxy whenever we want to download something (thus the sed part in the command line to add --proxy $Proxy everywhere... even when it's not needed like invoking curl --version) and same for git to clone nvm repo (-c http.proxy=$Proxy)
What would be nice is to set an env var and then in the install script, it would be possible to define additional options for curl and git to use.
Assuming NVM_PROXY the proxy we want nvm to use and CURL_PROXY / GIT_PROXY the option we would pass to these command:
if [ !-z${NVM_PROXY+x} ] ;then
CURL_PROXY="--proxy ${NVM_PROXY}"
GIT_PROXY="-c http.proxy=${NVM_PROXY}"fi
for the nvm.sh script, I only needed to change the curl command in the nvm_download function to get nvm working perfectly
But I guess there may be something to let it also update itself (eg. git pull) somewhere that I missed?
No, nvm doesn't update itself, you update it by rerunning the install script.
I agree it'd be a relatively straightforward addition to have nvm respect a proxy setting, but there's a few complications - for one, nvm works with either curl or wget, so we'd have to make sure the proxy argument was equally configurable - but more importantly, it'd be a huge source of bugs, and since you're the first person i'm aware of to request it in over a decade, we might want to wait until there's higher demand for it.
Ok, I understand your choice.
And as it was quite easy for me to "add" proxy option by simply using a sed command, I'll keep doing that for now.
Anyway, thank you very much for this tool that helps a lot and for listening to my request! 👍
Many thanks for this one. It works for me.
I have to emphasize that my company has those kind of proxy restrictions as well. I upvote a proxy support for nvm as well.
Thanks in advance
rivermanbw
Reading the replies to #963 my need of a proxy could also be resolved by setting the https_proxy linux env variable, but I would have to set it each time before invoking nvm.
I have to use various proxy and the default proxy set in https_proxy is not the one allowing me to use nvm...
Thus for me the need for a specific NVM_Proxy setting, it's far more convenient to use.
Activity
typhoe commentedon Jan 12, 2023
To use nvm, I also needed to add $Proxy var to the .nvm/nvm.sh script on line 124 in nvm_download() function
ljharb commentedon Jan 12, 2023
If you’re behind a proxy then installing node won’t work either, as you discovered. Why does your enterprise proxy block outbound requests?
typhoe commentedon Jan 12, 2023
No, it works with the change I posted.
I managed to install nodejs 14/16/18/19 and use them without any problem (after declaring my proxy of course when needed)
The proxy my enterprise uses is a filtering one.... only dns declared are allowed.
ljharb commentedon Jan 12, 2023
And there’s no way you could get them to allow github and nodejs.org?
typhoe commentedon Jan 12, 2023
I did, it works now BUT I have to tell curl and git to use the proxy.... thus the issue I posted
There's no option in nvm to tell it to use a proxy right now...
ljharb commentedon Jan 12, 2023
that's not what i mean - i mean, tell your company to be less restrictive in its proxy configuration.
Separately, could you use a SOCKS proxy so it was transparent to tooling?
I agree there's no option in nvm to use a proxy, and it explicitly ignores curlrc which might be configured to use one, but that's somewhat by design.
typhoe commentedon Jan 12, 2023
I'd really like if telling my company that was a possibility but that's the problem... most company put these type of restriction with the aim to limit access to external network, so no, that's not an option sadly...
I don't want to use a sock proxy because depending of what resource I need to access, I'm using various proxy or vpn depending of the use case.
But if you look at what I did, getting nvm to work with proxy seems pretty easy:
sedpart in the command line to add--proxy $Proxyeverywhere... even when it's not needed like invokingcurl --version) and same for git to clone nvm repo (-c http.proxy=$Proxy)What would be nice is to set an env var and then in the install script, it would be possible to define additional options for curl and git to use.
Assuming NVM_PROXY the proxy we want nvm to use and CURL_PROXY / GIT_PROXY the option we would pass to these command:
But I guess there may be something to let it also update itself (eg.
git pull) somewhere that I missed?ljharb commentedon Jan 13, 2023
No, nvm doesn't update itself, you update it by rerunning the install script.
I agree it'd be a relatively straightforward addition to have nvm respect a proxy setting, but there's a few complications - for one, nvm works with either curl or wget, so we'd have to make sure the proxy argument was equally configurable - but more importantly, it'd be a huge source of bugs, and since you're the first person i'm aware of to request it in over a decade, we might want to wait until there's higher demand for it.
typhoe commentedon Jan 13, 2023
Ok, I understand your choice.
And as it was quite easy for me to "add" proxy option by simply using a sed command, I'll keep doing that for now.
Anyway, thank you very much for this tool that helps a lot and for listening to my request! 👍
ZackaryJacobthereal commentedon Jan 14, 2023
typhoe commentedon Jan 15, 2023
rivermanbw commentedon Apr 25, 2023
Many thanks for this one. It works for me.
I have to emphasize that my company has those kind of proxy restrictions as well. I upvote a proxy support for nvm as well.
Thanks in advance
rivermanbw
ljharb commentedon Jun 10, 2024
Related: #963, #3366.
typhoe commentedon Jun 10, 2024
Reading the replies to #963 my need of a proxy could also be resolved by setting the https_proxy linux env variable, but I would have to set it each time before invoking nvm.
I have to use various proxy and the default proxy set in https_proxy is not the one allowing me to use nvm...
Thus for me the need for a specific NVM_Proxy setting, it's far more convenient to use.
[Feature] `nvm_download`: add NVM_PROXY_AUTH_HEADER for proxy authent…
[Feature] `nvm_download`: add NVM_PROXY_AUTH_HEADER for proxy authent…
[Feature] `nvm_download`: add NVM_PROXY_AUTH_HEADER for proxy authent…
[Feature] `nvm_download`: add NVM_PROXY_AUTH_HEADER for proxy authent…
[Tests] Make all test suites pass in the development container
[Tests] Make all test suites pass in the development container
[Feature] `nvm_download`: add NVM_PROXY_AUTH_HEADER for proxy authent…
[Feature] `nvm_download`: add NVM_PROXY_AUTH_HEADER for proxy authent…
[Feature] `nvm_download`: add NVM_PROXY_AUTH_HEADER for proxy authent…
[Tests] Make all test suites pass in the development container
[Tests] Make all test suites pass in the development container
[Tests] Make all test suites pass in the development container