-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[BUG] v 7.3.0 when publishing to private rep You need to authorize this machine using 'npm adduser' #2453
Comments
ArnesGroupNpm and ArnesNpm are different registries. |
This is nexus:
|
Ah, true - the publishConfig's registry is the one that's authed in npmrc. |
I am publishing my npm packages to my private npm registry via GitHub Actions and had the same issue. Am I correct that this currently effects everyone that uses |
That's been my findings so far. I hope the CLI team fixes this quickly. |
#2445 did not fix it afaik. |
Until a short while ago, I was seeing this very same issue with npm 7.5.1 when publishing to a private MyGet feed from our Jenkins system; despite a valid token in the |
We have the same problem with 7.5.4. using |
FWIW using
|
Same here using 7.6.0 and It seems that the publish command does not support a |
I'd argue this should be documented better, but I believe the |
It's a bit hard to understand indeed, but let's not start a debate about documentation. I managed to get it published using npm 6.14.4 and the --registry flag. |
when is this being fixed? I upgraded my npm from 6.* to 7.* and I'm running into this. i'm trying to publish into a private github package. The suggestion to use |
tested with set publish registry in "publishConfig": {
"registry": "https://npm.pkg.github.com/"
}
The |
I checked the source code behind the if (!dryRun) {
const resolved = npa.resolve(manifest.name, manifest.version)
const registry = npmFetch.pickRegistry(resolved, opts)
const creds = this.npm.config.getCredentialsByURI(registry)
if (!creds.token && !creds.username) {
throw Object.assign(new Error('This command requires you to be logged in.'), {
code: 'ENEEDAUTH',
})
}
await otplease(opts, opts => libpub(manifest, tarballData, opts))
} The problem is in this line: const creds = this.npm.config.getCredentialsByURI(registry) It checks the config for certain credential properties (eg. getCredentialsByURI (uri) {
const nerfed = nerfDart(uri)
const creds = {}
const email = this.get(`${nerfed}:email`) || this.get('email')
if (email)
creds.email = email
const tokenReg = this.get(`${nerfed}:_authToken`) ||
this.get(`${nerfed}:_authtoken`) ||
this.get(`${nerfed}:-authtoken`) ||
nerfed === nerfDart(this.get('registry')) && this.get('_authToken')
...
}
get (key, where) {
if (!this.loaded)
throw new Error('call config.load() before reading values')
return this[_get](key, where)
}
// we need to get values sometimes, so use this internal one to do so
// while in the process of loading.
[_get] (key, where = null) {
if (where !== null && !confTypes.has(where)) {
throw new Error('invalid config location param: ' + where)
}
const { data, source } = this.data.get(where || 'cli')
return where === null || hasOwnProperty(data, key) ? data[key] : undefined
} Notice data is retrieved using the |
Can you give an example of what the npm publish command would look like when passing auth as arguments? I don't see this documented anywhere at all. |
I had this issue on Gitlab with node 16.4.2 and npm 7.18.1 and solved it by pointing to the |
@coroiu Could you share your |
This one is also stopping us from publishing with Node 16. We just switched to a Node 14 image for our publish pipeline step. |
@radoslawgrochowski I followed @coroiu tip and it works for me, nexus 3.37, gitlab 14.6, node 16.13 and npm 8.1. Here is my setup: ~/.npmrc content, created after read this thread https://clavinjune.dev/en/blogs/npm-login-not-working/
Publish command |
Same problem for me. (Not logged in globaly)
run command: Note: for the most of the failed tries, |
This is still an issue with node v16.14.0 and npm v8.3.1. Worked fine with node 14.x and npm 5.x. |
@budgecode what about npm v8.5.1? |
Thanks, first solution that works for me :) |
+1 on it working when using |
It does look like this was due to configuration changes in npm7/8. publishConfig is being properly applied during publishes, and registry and scope-specific configs are working as expected in the latest npm. If folks are still experiencing issues publishing to private registries, please open individual tickets so that we can triage and debug your specific config setup. |
@wraithgar So this is now called a configuration change? Sounds like manager talk to me: After more than a year people have found workarounds or learned to live with version 6 anyway, just close the issue and let them file an issue for their "individual" problem, which most won't do or only do after another few months. 👎 |
I'm sorry that you feel this way, but the issue here originally was that publishConfig was not being properly applied during publish. That has been fixed. It is very likely you either have a separate issue or a config mismatch. The new issue template is designed to help us triage and debug these things. Comments in a closed issue are generally not a good place for that. As for the config, the data objects are cumulative. The internal [_get] only limits to the
This is not an attempt at ignoring the issue. If there is a bug we really do want to fix it. Please do open new issues and fill out the information requested so we can properly triage it. |
So what you're saying is that @sysmat 's issue is resolved? |
Yes their issue is resolved. publishConfig with a nerfed This is why it's so important to have separate issues for things. I know that on the surface these all feel like the same issue but they're not, and mixing them up in the comments slows down the debugging and triage process. We really are doing our best to fix issues, and the things we're asking for are in the interest of getting bugs fixed, I promise. Thank you for your attention to these issues and please continue to try to debug, and open issues if there are new bugs. |
Hi all, I'm still experiencing this issue when running
I spent whole afternoon until I go to a lower version, in my case I tried node 12, node v12.22.9 (npm v6.14.15), and it worked again |
Just found this command:
and use the right user, then was complaining about other information related to nexus which this helped me https://blog.katastros.com/a?ID=01750-614d5a39-d787-4987-89bb-0b2f03210e1f |
Coming here from npm In Note: the |
I was using nexus and your link saved me. This is what got me:
I couldn't imagine that nexus would not have that on by default so I never thought to check. |
Though not directly related to the We build our library and then publish as follows: -> npm publish dist/my-library
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/dist/my-library.git
npm ERR! ERROR: Repository not found.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists. After updating to node 16, it appears the trailing slash on the path is required. Without it, npm tries to use an SSH URL, as observed in the failed output. The solution was to use the path with a trailing slash: npm publish dist/my-library/ |
Current Behavior:
Can not publish(This command requires you to be logged in) but I adduser successfully
Expected Behavior:
Steps To Reproduce:
Environments:
The text was updated successfully, but these errors were encountered: