[rush] Cannot publish: getting ENEEDAUTH even though I'm already authenticated
kaiyoma opened this issue · comments
Summary
I'm trying to publish monorepo packages to an Artifactory npm registry, but no matter what I try, I get an error about being unauthenticated, even though I'm already authenticated.
Repro steps
$ npm whoami
srv-npm-registry
$ rush-pnpm publish -r --no-git-checks
...
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to (redacted)
npm ERR! need auth You need to authorize this machine using `npm adduser`
Details
It doesn't matter if I use npm login
and specify the username/password on the command line, or if I store the auth token inside .npmrc
. Same result either way.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
Question | Answer |
---|---|
@microsoft/rush globally installed version? |
5.117.9 |
rushVersion from rush.json? |
5.117.9 |
Operating system? | Windows 11 |
Would you consider contributing a PR? | No |
Node.js version (node -v )? |
20.11.1 |
Which .npmrc
file are you sticking the credentials in? I'm not particularly familiar with how Artifactory's authentication works, there may be quirks in how it expects credentials.
Can you try setting the credentials as an environment variable, referenced in the common/config/rush/.npmrc
or common/config/rush/.npmrc-publish
file?
The credentials were already in common/config/rush/.npmrc
. I tried copying them to common/config/rush/.npmrc-publish
but that didn't help.
As a workaround, I ended up writing a small tool that simulates what rush-pnpm does: it iterates over the directories of packages, copies common/config/rush/.npmrc
into each one, then runs npm publish
inside the package directory. This works correctly, so it's our solution for now. But isn't this basically what rush-pnpm should be doing?