Node.js ecosystem

Proxy settings for npm, yarn, pnpm, bun and nvm.

npm

bash
npm config set proxy http://127.0.0.1:7898
npm config set https-proxy http://127.0.0.1:7898
# unset
npm config delete proxy && npm config delete https-proxy

pnpm

bash
pnpm config set proxy http://127.0.0.1:7898
pnpm config set https-proxy http://127.0.0.1:7898

yarn

bash
# Yarn 1
yarn config set proxy http://127.0.0.1:7898
yarn config set https-proxy http://127.0.0.1:7898
# Yarn 2+ (Berry)
yarn config set httpProxy http://127.0.0.1:7898
yarn config set httpsProxy http://127.0.0.1:7898

bun

bun reads the HTTPS_PROXY / HTTP_PROXY environment variables, so the terminal variables are enough.

nvm / fnm (downloading Node itself)

nvm downloads Node with curl / wget, which read the environment variables:

bash
eval "$(cnb env)"   # or export https_proxy by hand
nvm install --lts

Third-party mirrors and the official registry

If you previously configured a third-party npm mirror (registry), you can keep it or switch back to the official registry https://registry.npmjs.org/ through acceleration. Both work side by side, but the official registry always has the latest packages first.