I'm using Verdaccio to host a private NPM registry on a machine that doesn't have access to the internet. So far, I've successfully published thousands of packages to the registry. However, when trying to publish hoist-non-react-statics-3.3.2-latest.tgz
, I get the following error: "This command requires you to be logged in. You need to authorize this machine using 'npm adduser'." The thing is, I have added myself as a user (which is why I've been able to publish so many packages already), and I've confirmed that I'm logged in via npm whoami
. I've also done an npm logout
and an npm login
. I've also tried turning off user authentication in Verdaccio (https://verdaccio.org/docs/authentication/). Unfortunately, nothing I've tried is letting me publish this package to the registry. Any ideas?
Asked
Active
Viewed 837 times
2

Caleb Koch
- 656
- 1
- 9
- 15
1 Answers
1
After digging into node/lib/node_modules/npm/lib/publish.js
, I realized the registry it's trying to use when checking that I'm authenticated was the public NPM registry, not my self-hosted registry. The solution was to remove these lines of code from hoist-non-react-statics
's package.json
file before publishing it: https://github.com/mridgway/hoist-non-react-statics/blob/master/package.json#L49-L51.

Caleb Koch
- 656
- 1
- 9
- 15
-
Pull requests for this package and another package that was causing me the same problem: (1) https://github.com/mridgway/hoist-non-react-statics/pull/116, (2) https://github.com/apideck-libraries/better-ajv-errors/pull/17. – Caleb Koch Feb 03 '22 at 17:14