deno gives 401 unauthorized for imports with an `npm:` specifier, but npm, yarn and pnpm all work?
heya!
i'm having difficulty with getting
npm:
specifiers to work. i've tried them via an import like below, or running via the cli. both give a 401 error for any package (regardless of if it's scoped, unscoped, using a specific npm config registry or anything).
i tried this in all of stable
, canary
and rc
deno versions - all have the same. i'll include debug logs from the latest rc
it used to work a few weeks ago, then it stopped working with all versions for a bit, then i created a new artifactory token and put that in my npmrc and it worked for a few days, and now it's back to not working again?
if it makes any difference, i'm using company vpn. and i had vscode closed and i was using a new terminal for this test, same result :/
both of these don't work and give this error:
i'll add debug logs and configs in the following messages20 Replies
here's my
~/.npmrc
(i replaced all instances of my password with "supersecret", all instances of my username with "myusername" and all instances of my company name with "mycompany" - nothing more):
debug/backtrace log (replaced my username and company name, changed the ips - rest is the asme):
here's an anonymized
npm config list --json
(apparently it's too long to copy)Do you have a single npmrc file or multiple files?
afaik it only looks in 1 place? but if you can let me know where to look (apart from my home directory, because the one i shared is the one from my home dir) then i'm happy to share
Deno only looks up in your project dir and falls back to home dir
But it doesn't merge them like npm does
when running the deno scripts, i was in
~/Documents/deno-scripts
, and the only .npmrc
between there and my home directory is the one in my home directory (which i shared above)npmrc | npm Docs
The npm config files
Okay, thanks. Could I ask you to open an issue in GH? It's definitely a bug and I'm OOO today and i don't want it to get lost
ahhh i forgot the global one. i don't think it's that but lets see
GitHub
Build software better, together
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.
sorry will try make in a bit 🙂
i ran
npm config ls -l
, which to my understanding, prints the fully resolved config for npm (along with the file/place it came from).
i attached the result after replacing my username with myusername
and my company with mycompany
(nothing else changed)
i also ran
yarn config --json
(and converted the newline-delimited json to a json array) and did the same replacements and uploaded thatnot sure if they somehow help at all but i can make a bug report soon. if those give away the issue tho then please let me know 🙂
sorry for delay, i posted it here: https://github.com/denoland/deno/issues/26033
GitHub
401 Unauthorized when trying to import with
npm:
specifier · Issu...Directed here from this Discord thread: Deno > #help > deno gives 401 unauthorized for imports with an npm: specifier, but npm, yarn and pnpm all work Tested Deno Versions (all same result): ...
I'm having a similar 401 issue with a private registry hosted on Azure DevOps -
With the error message it returns it appears as though the credentials defined aren't properly being passed?
(I'm defining
username
and _password
in the project .npmrc
, npm installs without issue)@mrkwse can you give more details? Where do you have .npmrc file? Do you use multiple files? Ie. One in your project and the other in your home dir?
Hi, just a single
.npmrc
in project root (same dir as project.json
)Then it should definitely work 😦 opening an issue with as many details as possible would be help - obviously without sharing any private information
We'll look into it this week
Should I add to the issue above or open a new one?
Either one works!
have added a comment here that i managed to resolve it for myself https://github.com/denoland/deno/issues/26033#issuecomment-2422657021
GitHub
401 Unauthorized when trying to import with
npm:
specifier · Issu...Directed here from this Discord thread: Deno > #help > deno gives 401 unauthorized for imports with an npm: specifier, but npm, yarn and pnpm all work Tested Deno Versions (all same result): ...