Since PNPM v11.6 my deployments break
maiertech
HOBBYOP

2 months 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+?

Solved$10 Bounty

Pinned Solution

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.

4 Replies

Railway
BOT

2 months ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway 2 months 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.

rotimi-best
PRO

2 months ago

I logged in just to tell you thank you for this comment. I didn't find even one documentation to doing this.


maiertech
HOBBYOP

2 months ago


maiertech

I'm sharing PNPM's post on this topic: https://pnpm.io/blog/2026/06/11/env-variables-in-repository-npmrc.

rotimi-best
PRO

2 months ago

I wish Railway had one specifically for this use case. Railway needs a doc for this cause, you can't use this pnpm config set from the dashboard, I was using the dashboard for building and starting my app now I had to migrate everything to use Railpack. It wasn't much work but worth pointing out.


Status changed to Solved 0x5b62656e5d 2 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...