Last pnpm version that worked
10.33.2
pnpm version
11.0.0
Code to reproduce the issue
Have a package with the following in the package.json:
"publishConfig": {
"registry": "https://some.custom/registry"
}
Have a different registry defined in your .npmrc:
registry=https://some.custom/other-registry
Attempt to publish that single package with pnpm publish.
Expected behavior
pnpm should use the registry from the package's publishConfig.registry field, if present.
Actual behavior
pnpm is not using the package's publishConfig.registry field, if present. Instead, it uses the registry defined in the .npmrc. I can see this because the output from the publish command includes this:
📦 @my/package@2.0.0 → https://my.nexus/repository/npm/
Whereas I would expect it to include this:
📦 @my/package@2.0.0 → https://my.nexus/repository/npm-hosted/
I can also see this because I've manually authenticated by adding a token to my global .npmrc (and the auth.ini, just in case), but I'm getting a 401 on publish because it can't find that token.
Additional information
For me, this is happening in a monorepo, with the .npmrc at the root of the repository. Here's a quick background on why I ran into this issue:
My company has a Sonatype Nexus Repository Manager instance for internal packages. It has three npm repositories:
/npm-hosted/ - a true repository that we upload our internal packages to
/npm-proxy/ - a proxy to the standard npm registry
/npm/ - a group repository that we actually install packages from. When a package is requested, it first checks /npm-hosted/ before checking /npm-proxy/.
The distinct repositories mean that we publish to a different registry than we install from. Here, I need to publish to /npm-hosted/ and everything else installs from /npm/. The group repository is read-only, so we can't just publish to /npm/.
Node.js version
24.14.1
Operating System
Linux
Last pnpm version that worked
10.33.2
pnpm version
11.0.0
Code to reproduce the issue
Have a package with the following in the
package.json:Have a different registry defined in your
.npmrc:registry=https://some.custom/other-registryAttempt to publish that single package with
pnpm publish.Expected behavior
pnpm should use the registry from the package's
publishConfig.registryfield, if present.Actual behavior
pnpm is not using the package's
publishConfig.registryfield, if present. Instead, it uses the registry defined in the.npmrc. I can see this because the output from the publish command includes this:Whereas I would expect it to include this:
I can also see this because I've manually authenticated by adding a token to my global
.npmrc(and theauth.ini, just in case), but I'm getting a 401 on publish because it can't find that token.Additional information
For me, this is happening in a monorepo, with the
.npmrcat the root of the repository. Here's a quick background on why I ran into this issue:My company has a Sonatype Nexus Repository Manager instance for internal packages. It has three npm repositories:
/npm-hosted/- a true repository that we upload our internal packages to/npm-proxy/- a proxy to the standard npm registry/npm/- a group repository that we actually install packages from. When a package is requested, it first checks/npm-hosted/before checking/npm-proxy/.The distinct repositories mean that we publish to a different registry than we install from. Here, I need to publish to
/npm-hosted/and everything else installs from/npm/. The group repository is read-only, so we can't just publish to/npm/.Node.js version
24.14.1
Operating System
Linux