pnpm ERR_PNPM_INVALID_PROXY: Fix Empty HTTP_PROXY and HTTPS_PROXY
If pnpm prints ERR_PNPM_INVALID_PROXY and the reported proxy value is empty, remove the empty variable before installing or replace it with a complete proxy URL. Do not “fix” the error by adding another empty HTTP_PROXY value to the repository.
The failure was reported for pnpm v12.0.0-beta.0 when an empty HTTP_PROXY or HTTPS_PROXY reached configuration parsing. The issue is closed through a fix, but CI images and developer machines do not all update at the same time. Unsetting empty proxy variables is a safe workaround across versions.
Unset empty proxy variables before pnpm install
On macOS, Linux, and other shells that provide env -u, run the install with the empty variables removed:
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY \ -u http_proxy -u https_proxy -u all_proxy \ pnpm install --frozen-lockfileFor a GitHub Actions step, unset the variables inside the shell that runs pnpm:
- name: Install dependencies shell: bash run: | unset HTTP_PROXY HTTPS_PROXY ALL_PROXY unset http_proxy https_proxy all_proxy pnpm install --frozen-lockfileSetting the variables to "" is not the same as removing them. An empty value can still be parsed as a proxy setting by an affected pnpm version.
In PowerShell, remove the process-level values before invoking pnpm:
$env:HTTP_PROXY = $null$env:HTTPS_PROXY = $null$env:ALL_PROXY = $nullpnpm install --frozen-lockfileDo this only when the job is not supposed to use a corporate proxy. If the network requires one, configure a valid URL instead of unsetting it.
If a proxy is required, use a valid URL
A proxy value needs a scheme and an address, for example:
pnpm install --frozen-lockfileURL-encode reserved characters in the username or password. A raw @, #, %, or space can turn an otherwise correct credential into an invalid URL. Keep credentials in the CI secret store or the user-level configuration that your environment controls; do not commit them to a project .npmrc.
Inspect what pnpm sees without printing a secret-bearing configuration file:
pnpm config get proxypnpm config get https-proxypnpm config listThen check the environment separately:
env | grep -iE '^(http|https|all)_proxy='The command output is diagnostic data. Redact credentials before pasting it into an issue or CI log.
Understand the pnpm 12 status before changing every workflow
The pnpm issue #13533 records the empty-proxy regression, including the ERR_PNPM_INVALID_PROXY symptom and the difference from pnpm 11 behavior. Pull request #13597 treats empty proxy values as unset and closes that issue.
That does not mean every runner has the repaired code. pnpm 12.0.0-rc.7 was released on August 18, 2026, while the visible release notes do not make the proxy fix easy to identify. Check the executable that actually runs in CI:
pnpm --versioncommand -v pnpmIf the version is an older beta or the error persists after an upgrade, keep the unset step until the image is updated and the install passes. Do not silently change the lockfile or the package manager version while diagnosing an environment-variable parse failure.
The pnpm .npmrc documentation is the right place to review project and user configuration. A project-level proxy setting is a different input from an environment variable, but both can affect the install boundary. Check the actual configuration locations used by the CI account.
Keep proxy cleanup separate from dependency failures
Once the proxy error is gone, a later install failure may be unrelated. Keep these cases distinct:
- a registry authentication error means the registry or token boundary needs inspection;
- a Git dependency over SSH needs keys and a known-hosts setup, as covered in the pnpm Git dependency CI guide;
- a package install script blocked by pnpm policy is a lifecycle configuration issue, not a proxy URL issue. The pnpm build-script approval guide covers that boundary.
Run the same frozen install after the environment is corrected:
pnpm install --frozen-lockfilepnpm audit --audit-level=highThe second command is optional and should follow the project’s normal security workflow; it is not evidence that the proxy was configured correctly.
The durable rule is to represent “no proxy” by an absent variable, not an empty URL. If a proxy is required, provide a complete URL, keep its credentials out of the repository, and verify the pnpm version inside the failing job before changing dependency files.
FAQ
Q: Is an empty HTTP_PROXY the same as no proxy?
A: Not for every pnpm version. The empty variable still reaches proxy parsing and can produce ERR_PNPM_INVALID_PROXY. Remove the variable when no proxy is required.
Q: Should I add HTTP_PROXY= to the GitHub Actions env block?
A: No, not as a workaround for this error. An empty value can reproduce the failure. Use unset in the install shell, or set a valid proxy URL when the network requires one.
Q: How can I tell whether pnpm or .npmrc supplied the proxy?
A: Print the pnpm version and pnpm config get proxy / pnpm config get https-proxy, then inspect proxy environment variables separately. Redact credentials and compare the CI account’s configuration locations with your local user configuration.
References:
pnpm issue #13533: Empty HTTP_PROXY/HTTPS_PROXY variables cause parse failure
Report a typo or broken link, or suggest a related topic.