Skip to content

pnpm Proxy Settings: httpsProxy, Yarn and Bun Behind a Proxy

Where pnpm, Yarn and Bun read their proxy from, and which parts the official pages leave undocumented.

What each tool documents

What each tool documents
ItempnpmYarn Berry (2+)Bun
Settings or variableshttpsProxy, httpProxy, noProxy; also read from .npmrchttpProxy and httpsProxy in .yarnrc.ymlfetch() reads HTTP_PROXY, HTTPS_PROXY, ALL_PROXY and NO_PROXY
FallbackshttpsProxy: proxy, then HTTPS_PROXY; httpProxy: httpsProxy, then HTTP_PROXY; noProxy: noproxy, then NO_PROXYNone documentedHTTP_PROXY for http: URLs, HTTPS_PROXY for https: URLs; ALL_PROXY when the specific one is unset
Skip listnoProxy, comma-separated domain extensionsnoProxy not documentedNO_PROXY, comma- or space-separated
Login in the URLNot stated on the pages we readNot stated; examples use http://proxy:4040Not shown for the proxy URL; a Proxy-Authorization header overrides URL credentials
SOCKSNot mentionedNot mentionedsocks5:// values in ALL_PROXY are ignored

Sources: the pnpm settings and .npmrc pages, the Yarn .yarnrc reference, and the Bun fetch page, all read on 16 November 2026. "Not stated" means the pages we read do not say, not that it is unsupported; test with your own proxy.

pnpm: three settings and where they live

pnpm lists httpsProxy, httpProxy and noProxy under network settings. httpsProxy defaults to null and falls back to the legacy proxy setting, then to HTTPS_PROXY or https_proxy. httpProxy, if unset, uses what httpsProxy resolved to, then HTTP_PROXY or http_proxy. noProxy is a comma-separated string of domain extensions a proxy should not be used for, and falls back to noproxy, then NO_PROXY or no_proxy.

pnpm reads proxy settings from .npmrc files, and the .npmrc page adds one limit: in a project .npmrc, registry and proxy URLs (registry, proxy, https-proxy, http-proxy) cannot reference environment variables; pnpm ignores such a setting and prints a warning. Write the full address there, or set the environment variable instead of the file. Put credentials in a file you will not commit.

pnpm: environment variables and .npmrc, example

# one terminal session: pnpm falls back to these variables
export HTTPS_PROXY="http://LOGIN:PASSWORD@HOST:PORT"
export HTTP_PROXY="http://LOGIN:PASSWORD@HOST:PORT"
export NO_PROXY="localhost,127.0.0.1"
pnpm install

# or in ~/.npmrc (full address, no ${VARIABLE} inside)
https-proxy=http://LOGIN:PASSWORD@HOST:PORT
proxy=http://LOGIN:PASSWORD@HOST:PORT

Example only: replace the placeholders. Not run here; the setting names and fallbacks follow the pnpm pages. The pages do not say whether pnpm accepts login in the proxy URL, so confirm with the curl test below, and URL-encode special characters in the password.

Yarn Berry: .yarnrc.yml

Yarn 2 and later documents httpProxy ("proxy to use when making an HTTP request") and httpsProxy ("a proxy to use when making an HTTPS request"), both set in .yarnrc.yml, with examples such as http://proxy:4040. The reference page lists no noProxy setting and no mention of SOCKS or of login in the URL. networkSettings can hold httpProxy per hostname.

This section covers Yarn Berry only. We did not read the Yarn 1 configuration pages, so if yarn --version starts with 1, check that version's own documentation.

Yarn Berry: .yarnrc.yml, example

httpProxy: "http://LOGIN:PASSWORD@HOST:PORT"
httpsProxy: "http://LOGIN:PASSWORD@HOST:PORT"

Example only: replace the placeholders. Not run here; the key names follow the Yarn .yarnrc reference, whose own example is http://proxy:4040 without login.

Bun: what is documented

The Bun fetch page says that without a proxy option, Bun reads HTTP_PROXY, HTTPS_PROXY and ALL_PROXY (upper or lower case) each time fetch runs. ALL_PROXY is used when the specific variable is unset, and a value naming another kind of proxy, such as socks5://, is ignored. NO_PROXY lists hosts that skip the proxy and also applies to an explicit proxy option; respectNoProxy: false and proxy: false change that.

That page is about fetch() in your own code. The Bun install and .npmrc pages we read do not mention proxy settings, so we cannot tell you how bun install behaves. Set the variables in the same shell, run a small install, and confirm with the curl test and your proxy's traffic view before relying on it in CI.

Bun: fetch() with a proxy, example

// fetch() in your own script
const res = await fetch("https://registry.npmjs.org/left-pad", {
  proxy: "http://LOGIN:PASSWORD@HOST:PORT",
});
console.log(res.status);

Example only, for scripts, not for bun install. Not run here; the proxy option follows the Bun fetch page, which does not show login inside the proxy URL.

How to test the proxy before blaming the package manager

  1. Step 1: test the proxy with curl

    Run the curl command below with the same HOST, PORT, LOGIN and PASSWORD. A 200 or 301 status means the proxy reaches the registry.

    Expected result Expected: an HTTP status line from the registry, not a proxy error.

  2. Step 2: install something small

    In an empty folder, run pnpm install, yarn install or bun install on a project with one dependency, with the proxy set the way described above.

  3. Step 3: change one thing at a time

    If curl works and the install does not, change only one thing: the variable name, the address format or the file the setting lives in.

Test the proxy: example

curl -I -x "http://LOGIN:PASSWORD@HOST:PORT" https://registry.npmjs.org/

Example only: replace the placeholders. curl -x with an http:// proxy address is standard curl usage; not run against a real proxy here.

If the install fails behind a proxy

curl works, the install hangs

Check The tool is not using the proxy: the setting is in a file it does not read, or the variable name is wrong (names are matched in upper or lower case, and pnpm lists its own fallbacks).

Fix Set the variable in the same shell, or write the full address into the file the tool documents. In a project .npmrc, do not use ${VARIABLE} for proxy URLs.

Stop when If curl itself fails, stop and fix the proxy first; see the proxy authentication guide.

407 Proxy Authentication Required

Check The proxy wants login and did not get it, or the password has characters such as @ or : that need URL encoding.

Fix Check LOGIN and PASSWORD in My assets, and percent-encode special characters in the URL.

Stop when Do not keep retrying; repeated failed logins gain nothing.

Local or private registries stop working

Check Their addresses are being sent through the proxy.

Fix Add them to noProxy (pnpm) or NO_PROXY, keeping each tool's format in mind.

Stop when Yarn Berry documents no noProxy; if you need an exception there, test it or use the environment variable approach for other tools.

Which Proxy302 product fits installs

Package installs rarely care where the exit IP is, so the plainest fit is a datacenter IP rented per IP: US$0.25 for 1 day, US$0.75 for 3 days, US$1.75 for 7 days and US$3.99 for 30 days, the same in every country, with HTTP on port 2222 or SOCKS5 on port 3333 chosen when you buy. The country list and stock are shown on the order page. Use the HTTP asset for the tools above.

There is no free trial. The smallest purchase is one IP for one day, so try it on a single project first.

pnpm, Yarn and Bun proxy: FAQ

How do I set a proxy for pnpm?

Use the httpsProxy and httpProxy settings, write https-proxy and proxy in .npmrc, or set HTTPS_PROXY and HTTP_PROXY in the shell. pnpm falls back from httpsProxy to proxy to HTTPS_PROXY.

Does pnpm support SOCKS proxies?

The pnpm pages we read do not mention SOCKS. Use an HTTP proxy address.

How do I tell Yarn Berry to skip the proxy for some hosts?

The .yarnrc reference documents httpProxy and httpsProxy and no noProxy setting, so there is no documented switch for it.

Does bun install use HTTP_PROXY?

The Bun page we read documents HTTP_PROXY, HTTPS_PROXY and NO_PROXY for fetch(). We found no official statement about bun install, so run a test.

Can I put the login in the proxy URL?

It is the common syntax and the examples in this guide use it, but none of the three pages we read states it for the package managers. Confirm with curl and a small install.

Reference links

5
  1. pnpm: network settings (httpsProxy, httpProxy, noProxy)

    Official documentation · Confirmed on:

    Read on 16 November 2026: defaults and fallback order of httpsProxy, httpProxy and noProxy.

  2. pnpm: .npmrc

    Official documentation · Confirmed on:

    Read on 16 November 2026: proxy settings are read from .npmrc; registry and proxy URLs in a project .npmrc cannot reference environment variables, and pnpm ignores such a setting with a warning.

  3. Yarn: .yarnrc.yml settings

    Official documentation · Confirmed on:

    Read on 16 November 2026: httpProxy and httpsProxy with the example http://proxy:4040; no noProxy entry; networkSettings per hostname.

  4. Bun: fetch

    Official documentation · Confirmed on:

    Read on 16 November 2026: the proxy option, HTTP_PROXY, HTTPS_PROXY, ALL_PROXY and NO_PROXY handling, Proxy-Authorization header; socks5:// values in ALL_PROXY are ignored.

    About fetch() in scripts. The Bun install and .npmrc pages read the same day do not mention proxies.

  5. Proxy302 product facts and price list

    Product observation · Confirmed on:

    Product information of the site, checked 16 November 2026: static ISP and datacenter per-IP prices in US$, lease terms, protocols and ports (HTTP 2222, SOCKS5 3333), no free trial.

Ready to try it?

Create an account, top up once, then pick rotating residential, static ISP or datacenter IPs and have one running in your browser within minutes.