Verify latest release
pnpm version
11.0.0-rc.2
Which area(s) of pnpm are affected? (leave empty if unsure)
CLI, Operating System (Windows, MacOS, Linux)
Link to the code that reproduces this issue or a replay of the bug
No response
Reproduction steps
-
Put an unresolved auth placeholder in the user-level .npmrc, for example:
//registry.example.com/:_auth=${EXAMPLE_TOKEN}
-
Run pnpm in an environment where EXAMPLE_TOKEN is not defined.
One easy way to do that is to launch pnpm from a child process with a reduced environment that keeps PATH but omits EXAMPLE_TOKEN.
-
Run a command that loads config, for example:
-
Observe that pnpm fails before normal command execution.
ERROR Invalid character
For help, run: pnpm help install
Describe the Bug
On main, the config path does this (AI authored, NOT VERIFIED)
config/reader/src/loadNpmrcFiles.ts reads the .npmrc entry.
envReplace() cannot substitute the missing ${...} token.
substituteEnv() records a warning and preserves the unresolved string.
config/reader/src/getNetworkConfigs.ts collects _auth / _password from that config.
config/reader/src/parseCreds.ts calls parseBasicAuth().
parseBasicAuth() calls atob('${EXAMPLE_TOKEN}').
atob() throws InvalidCharacterError: Invalid character.
The stack is:
parseBasicAuth() in config/reader/src/parseCreds.ts
getNetworkConfigs() in config/reader/src/getNetworkConfigs.ts
getConfig() in config/reader
So this is not a CLI parsing problem. It is a config/auth parsing failure caused by unresolved placeholder text being preserved and then treated as base64 auth input. The problem is
- unresolved credential placeholders reach auth parsing,
- auth parsing crashes on them,
- and pnpm reports the result as a top-level CLI usage error.
Expected Behavior
pnpm should not pass unresolved credential placeholders into base64 auth decoding.
At minimum, if .npmrc auth config still contains ${VAR} placeholders, pnpm should surface a config/auth-specific outcome instead of:
- crashing in
atob(), and
- printing
For help, run: pnpm help install.
Possible policy choices include:
- keep the unresolved literal and continue,
- ignore that auth entry,
- or fail fast with a config error.
Which Node.js version are you using?
24.11.1
Which operating systems have you used?
If your OS is a Linux based, which one it is? (Include the version if relevant)
No response
Verify latest release
pnpm version
11.0.0-rc.2
Which area(s) of pnpm are affected? (leave empty if unsure)
CLI, Operating System (Windows, MacOS, Linux)
Link to the code that reproduces this issue or a replay of the bug
No response
Reproduction steps
Put an unresolved auth placeholder in the user-level
.npmrc, for example://registry.example.com/:_auth=${EXAMPLE_TOKEN}Run pnpm in an environment where
EXAMPLE_TOKENis not defined.One easy way to do that is to launch pnpm from a child process with a reduced environment that keeps
PATHbut omitsEXAMPLE_TOKEN.Run a command that loads config, for example:
Observe that pnpm fails before normal command execution.
Describe the Bug
On main, the config path does this (AI authored, NOT VERIFIED)
config/reader/src/loadNpmrcFiles.tsreads the.npmrcentry.envReplace()cannot substitute the missing${...}token.substituteEnv()records a warning and preserves the unresolved string.config/reader/src/getNetworkConfigs.tscollects_auth/_passwordfrom that config.config/reader/src/parseCreds.tscallsparseBasicAuth().parseBasicAuth()callsatob('${EXAMPLE_TOKEN}').atob()throwsInvalidCharacterError: Invalid character.The stack is:
parseBasicAuth()inconfig/reader/src/parseCreds.tsgetNetworkConfigs()inconfig/reader/src/getNetworkConfigs.tsgetConfig()inconfig/readerSo this is not a CLI parsing problem. It is a config/auth parsing failure caused by unresolved placeholder text being preserved and then treated as base64 auth input. The problem is
Expected Behavior
pnpm should not pass unresolved credential placeholders into base64 auth decoding.
At minimum, if
.npmrcauth config still contains${VAR}placeholders, pnpm should surface a config/auth-specific outcome instead of:atob(), andFor help, run: pnpm help install.Possible policy choices include:
Which Node.js version are you using?
24.11.1
Which operating systems have you used?
If your OS is a Linux based, which one it is? (Include the version if relevant)
No response