2 days ago
I'm deploying a Node-based website, which installs one package from a private registry. To access the registry I need to authenticate.
I used to do this with a project .npmrc with this line:
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
I would set NODE_AUTH_TOKEN as a variable on Railway and PNPM would expand it. But that's not allowed any more in PNPM v11.6.
PNPM lists alternatives on their website: https://pnpm.io/npmrc.
The obvious solution should be to set env var pnpm_config_//registry.npmjs.org/:_authToken but this breaks the build on Railway because Railpack can't handle the variable name?
Does the Railway team have a recommendation how to deal with PNPM v11.6+?
3 Replies
2 days ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 2 days ago
2 days ago
pnpm recommends running the command: pnpm config set //registry.npmjs.org/:_authToken "$NPM_TOKEN" which writes to the global location by default, not to the project .npmrc . You can specify a custom install command in your Railpack config file, or you can always switch to a Dockerfile setup and have full control.
darseen
pnpm recommends running the command: `pnpm config set //registry.npmjs.org/:_authToken "$NPM_TOKEN"` which writes to the global location by default, not to the project `.npmrc` . You can specify a custom install command in your [Railpack config file](https://railpack.com/config/file), or you can always switch to a Dockerfile setup and have full control.
2 hours ago
I logged in just to tell you thank you for this comment. I didn't find even one documentation to doing this.
2 hours ago
I'm sharing PNPM's post on this topic: https://pnpm.io/blog/2026/06/11/env-variables-in-repository-npmrc.
