Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rush] Cannot publish: getting ENEEDAUTH even though I'm already authenticated #4671

Open
kaiyoma opened this issue Apr 30, 2024 · 2 comments

Comments

@kaiyoma
Copy link

kaiyoma commented Apr 30, 2024

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
@iclanton
Copy link
Member

iclanton commented May 6, 2024

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?

@kaiyoma
Copy link
Author

kaiyoma commented May 6, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Investigation
Development

No branches or pull requests

2 participants