pnpm i doesn't pick up .npmrc token changes caused by pnpm:devPreinstall script
#16292
Replies: 8 comments 2 replies
|
Does it work with npm? pnpm only reads the configs ones. You can try to use the token helper setting instead: https://pnpm.io/npmrc#urltokenhelper |
Thanks for this suggestion! If we can't find a way to automate out-of-the-box we'll have to write a simple binary to output the token from If the However I'm not convinced this isn't a bug (or maybe it should be a feature request) considering how common it is to need to authenticate with a private registry in the world of proprietary software. For that reason affordances to automate that process seem important to me, but I could be mistaken in it being npm/pnpm's responsibility to provide those affordances. |
|
An interesting thing I learned about using an Azure DevOps npm feed is that if you are also using Azure DevOps Git, and using Git Credential Manager Core (which is default for Windows Git nowadays) to manage your Git credential, you can reuse the Git credential as your npm token as long as the feed and the Git repository are on the same domain (because Git Credential Manager Core requests Package Read permissions in addition to Code Read + Write). You can then reference an environment variable in |
|
Just came across this bug with pnpm version It definitely feels like it should be a bug. Any feedback here indicating which direction pnpm plans to take this? Being able to have logic in the |
I'm only coming across this years later, but tokenHelper seems pretty useless for the purposes of my company, where we need something platform-independent that can supply a single registry token that all devs have to use to connect to a particular external registry. Requiring an absolute path doesn't work for that for obvious reasons. |
|
I have the same issue. I do have a script in Another use case: in |
|
I'm working on a fix for this. |
|
I am not sure we want to support it. We already have so many ways to set auth tokens. And |
Uh oh!
There was an error while loading. Please reload this page.
pnpm version: 7.13.5
Code to reproduce the issue:
Expected behavior:
When installing dependencies and the token in
$HOME/.npmrcneeds to be refreshed,pnpm:devPreinstallwill take care of refreshing viaazure-devops-npm-authresulting in a new valid token in$HOME/.npmrc. Then install will pick up the updated.npmrcand authenticate with the private registry.Actual behavior:
azure-devops-npm-authdoes what it's supposed to, but install proceeds with the old token resulting in having to runpnpm itwice.Obfuscated terminal output:
Additional information:
node -vprints: v16.14.2All reactions