denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
96.07k stars 5.31k forks source link

401 Unauthorized when trying to import with `npm:` specifier #26033

Open AllySummers opened 1 week ago

AllySummers commented 1 week ago

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):

When attempting to import anything using an npm: specifier, either in a typescript file or on the CLI, I get the following error:

error: Error getting response at https://packages.mycompany.com/artifactory/api/npm/npm-remote/@angular/cli for package "@angular/cli": Bad response: 401

{
  "errors" : [ {
    "status" : 401,
    "message" : "Bad credentials"
  } ]
}

This happens regardless of if I'm running a package from the CLI, i.e.:

deno run -A npm:@angular/cli

or if I'm trying to import from something in a script, i.e.:

import { Component } from 'npm:@angular/core';

(just using angular as an example here, it happens with every single package I tried it with, whether that was an unscoped public package, a public scoped package, or private scoped package)

If I rename/delete the .npmrc in my home directory and try running the exact same thing, it works perfectly fine. Only my npmrc seems to be the issue?

In the below files/logs/configs, I've replaced all instances of my username with myusername, all instances of my company's name with mycompany, and if applicable, replaced the IP address(es) and replaced my password with mypassword.

Results of ` RUST_BACKTRACE=1 DENO_LOG=debug deno run -A npm:@angular/cli` ```shell ~ RUST_BACKTRACE=1 DENO_LOG=debug deno run -A npm:@angular/cli DEBUG RS - deno::args:932 - Finished config loading. DEBUG RS - deno::cache::cache_db:168 - Opening cache /Users/myusername/Library/Caches/deno/dep_analysis_cache_v2... DEBUG RS - deno::cache::cache_db:168 - Opening cache /Users/myusername/Library/Caches/deno/node_analysis_cache_v2... DEBUG RS - deno::cache::cache_db:168 - Opening cache /Users/myusername/Library/Caches/deno/v8_code_cache_v2... DEBUG RS - deno::npm::managed::resolution:282 - Running npm resolution. DEBUG RS - hyper_util::client::legacy::connect::dns:122 - resolving host="packages.mycompany.com" DEBUG RS - hyper_util::client::legacy::connect::http:643 - connecting to 123.123.123.123:443 DEBUG RS - hyper_util::client::legacy::connect::http:646 - connected to 456.456.456.456:443 DEBUG RS - h2::client:1281 - binding client connection DEBUG RS - h2::client:1286 - client connection bound DEBUG RS - h2::codec::framed_write:213 - send frame=Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384, max_header_list_size: 16384 } DEBUG RS - h2::proto::connection:138 - Connection; peer=Client DEBUG RS - hyper_util::client::legacy::pool:396 - pooling idle connection for ("https", packages.mycompany.com) DEBUG RS - h2::codec::framed_write:213 - send frame=WindowUpdate { stream_id: StreamId(0), size_increment: 5177345 } DEBUG RS - h2::codec::framed_write:213 - send frame=Headers { stream_id: StreamId(1), flags: (0x5: END_HEADERS | END_STREAM) } DEBUG RS - h2::codec::framed_read:405 - received frame=Settings { flags: (0x0), max_concurrent_streams: 128, initial_window_size: 65536, max_frame_size: 16777215 } DEBUG RS - h2::codec::framed_write:213 - send frame=Settings { flags: (0x1: ACK) } DEBUG RS - h2::codec::framed_read:405 - received frame=WindowUpdate { stream_id: StreamId(0), size_increment: 2147418112 } DEBUG RS - h2::codec::framed_read:405 - received frame=Settings { flags: (0x1: ACK) } DEBUG RS - h2::proto::settings:56 - received settings ACK; applying Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384, max_header_list_size: 16384 } DEBUG RS - h2::codec::framed_read:405 - received frame=Headers { stream_id: StreamId(1), flags: (0x4: END_HEADERS) } DEBUG RS - h2::codec::framed_read:405 - received frame=Data { stream_id: StreamId(1) } DEBUG RS - h2::codec::framed_read:405 - received frame=Data { stream_id: StreamId(1), flags: (0x1: END_STREAM) } DEBUG RS - h2::codec::framed_write:213 - send frame=GoAway { error_code: NO_ERROR, last_stream_id: StreamId(0) } DEBUG RS - h2::proto::connection:428 - Connection::poll; connection error error=GoAway(b"", NO_ERROR, Library) error: Error getting response at https://packages.mycompany.com/artifactory/api/npm/npm-remote/@angular/cli%25C2%25A0 for package "@angular/cli%C2%A0": Bad response: 401 { "errors" : [ { "status" : 401, "message" : "Bad credentials" } ] } Stack backtrace: 0: std::backtrace::Backtrace::capture 1: anyhow::error:: for anyhow::Error>::from 2: deno::npm::managed::ManagedCliNpmResolver::add_package_reqs_raw::{{closure}} 3: deno::npm::managed::ManagedCliNpmResolver::add_package_reqs::{{closure}} 4: deno::worker::CliMainWorkerFactory::create_custom_worker::{{closure}} 5: deno::worker::CliMainWorkerFactory::create_main_worker::{{closure}} 6: deno::tools::run::run_script::{{closure}} 7: deno::spawn_subcommand::{{closure}} 8: as core::future::future::Future>::poll 9: tokio::runtime::task::raw::poll 10: deno::main 11: std::sys_common::backtrace::__rust_begin_short_backtrace 12: _main ```
My `~/.npmrc` (npmrc in home directory) ``` registry=https://packages.mycompany.com/artifactory/api/npm/npm-remote @mycompanysox:registry=https://packages.mycompany.com/artifactory/api/npm/mycompany-npm/ @fortawesome:registry=https://packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/ @mycompany:registry=https://packages.mycompany.com/artifactory/api/npm/mycompany-npm/ //packages.mycompany.com/artifactory/api/npm/mycompany-npm/:_password=mypassword //packages.mycompany.com/artifactory/api/npm/mycompany-npm/:username=myusername //packages.mycompany.com/artifactory/api/npm/mycompany-npm/:email=myusername@mycompany.com //packages.mycompany.com/artifactory/api/npm/mycompany-npm/:always-auth=true //packages.mycompany.com/api/npm/mycompany-npm/:_password=mypassword //packages.mycompany.com/api/npm/mycompany-npm/:username=myusername //packages.mycompany.com/api/npm/mycompany-npm/:email=myusername@mycompany.com //packages.mycompany.com/api/npm/mycompany-npm/:always-auth=true //packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/:_password=mypassword //packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/:username=myusername //packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/:email=myusername@mycompany.com //packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/:always-auth=true //packages.mycompany.com/api/npm/npm-remote-fontawesome/:_password=mypassword //packages.mycompany.com/api/npm/npm-remote-fontawesome/:username=myusername //packages.mycompany.com/api/npm/npm-remote-fontawesome/:email=myusername@mycompany.com //packages.mycompany.com/api/npm/npm-remote-fontawesome/:always-auth=true //packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/:_password=mypassword //packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/:username=myusername //packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/:email=myusername@mycompany.com //packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/:always-auth=true //packages.mycompany.com/api/npm/npm-remote-fontawesome/:_password=mypassword //packages.mycompany.com/api/npm/npm-remote-fontawesome/:username=myusername //packages.mycompany.com/api/npm/npm-remote-fontawesome/:email=myusername@mycompany.com //packages.mycompany.com/api/npm/npm-remote-fontawesome/:always-auth=true //packages.mycompany.com/artifactory/api/npm/npm-remote/:_password=mypassword //packages.mycompany.com/artifactory/api/npm/npm-remote/:username=myusername //packages.mycompany.com/artifactory/api/npm/npm-remote/:email=myusername@mycompany.com //packages.mycompany.com/artifactory/api/npm/npm-remote/:always-auth=true //packages.mycompany.com/api/npm/npm-remote/:_password=mypassword //packages.mycompany.com/api/npm/npm-remote/:username=myusername //packages.mycompany.com/api/npm/npm-remote/:email=myusername@mycompany.com //packages.mycompany.com/api/npm/npm-remote/:always-auth=true ```
Results of `npm config list --json --long` (I believe this shows the fully resolved/active config) ```json { "json": true, "long": true, "registry": "https://packages.mycompany.com/artifactory/api/npm/npm-remote", "@mycompanysox:registry": "https://packages.mycompany.com/artifactory/api/npm/mycompany-npm/", "@fortawesome:registry": "https://packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/", "@mycompany:registry": "https://packages.mycompany.com/artifactory/api/npm/mycompany-npm/", "//packages.mycompany.com/artifactory/api/npm/mycompany-npm/:username": "myusername", "//packages.mycompany.com/artifactory/api/npm/mycompany-npm/:email": "myusername@mycompany.com", "//packages.mycompany.com/artifactory/api/npm/mycompany-npm/:always-auth": true, "//packages.mycompany.com/api/npm/mycompany-npm/:username": "myusername", "//packages.mycompany.com/api/npm/mycompany-npm/:email": "myusername@mycompany.com", "//packages.mycompany.com/api/npm/mycompany-npm/:always-auth": true, "//packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/:username": "myusername", "//packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/:email": "myusername@mycompany.com", "//packages.mycompany.com/artifactory/api/npm/npm-remote-fontawesome/:always-auth": true, "//packages.mycompany.com/api/npm/npm-remote-fontawesome/:username": "myusername", "//packages.mycompany.com/api/npm/npm-remote-fontawesome/:email": "myusername@mycompany.com", "//packages.mycompany.com/api/npm/npm-remote-fontawesome/:always-auth": true, "//packages.mycompany.com/artifactory/api/npm/npm-remote/:username": "myusername", "//packages.mycompany.com/artifactory/api/npm/npm-remote/:email": "myusername@mycompany.com", "//packages.mycompany.com/artifactory/api/npm/npm-remote/:always-auth": true, "//packages.mycompany.com/api/npm/npm-remote/:username": "myusername", "//packages.mycompany.com/api/npm/npm-remote/:email": "myusername@mycompany.com", "//packages.mycompany.com/api/npm/npm-remote/:always-auth": true, "access": null, "all": false, "allow-same-version": false, "also": null, "audit": true, "audit-level": null, "auth-type": "web", "before": null, "bin-links": true, "browser": null, "ca": null, "cache": "/Users/myusername/.npm", "cache-max": null, "cache-min": 0, "cafile": null, "call": "", "cert": null, "cidr": null, "color": true, "commit-hooks": true, "cpu": null, "os": null, "libc": null, "depth": null, "description": true, "dev": false, "diff": [], "diff-ignore-all-space": false, "diff-name-only": false, "diff-no-prefix": false, "diff-dst-prefix": "b/", "diff-src-prefix": "a/", "diff-text": false, "diff-unified": 3, "dry-run": false, "editor": "hx", "engine-strict": false, "expect-results": null, "expect-result-count": null, "fetch-retries": 2, "fetch-retry-factor": 10, "fetch-retry-maxtimeout": 60000, "fetch-retry-mintimeout": 10000, "fetch-timeout": 300000, "force": false, "foreground-scripts": false, "format-package-lock": true, "fund": true, "git": "git", "git-tag-version": true, "global": false, "globalconfig": "/Users/myusername/.nvm/versions/node/v18.20.1/etc/npmrc", "global-style": false, "heading": "npm", "https-proxy": null, "if-present": false, "ignore-scripts": false, "include": [], "include-staged": false, "include-workspace-root": false, "init-author-email": "", "init-author-name": "", "init-author-url": "", "init-license": "ISC", "init-module": "/Users/myusername/.npm-init.js", "init-version": "1.0.0", "init.author.email": "", "init.author.name": "", "init.author.url": "", "init.license": "ISC", "init.module": "/Users/myusername/.npm-init.js", "init.version": "1.0.0", "install-links": false, "install-strategy": "hoisted", "key": null, "legacy-bundling": false, "legacy-peer-deps": false, "link": false, "local-address": null, "sbom-format": null, "sbom-type": "library", "location": "user", "lockfile-version": null, "loglevel": "notice", "logs-dir": null, "logs-max": 10, "maxsockets": 15, "message": "%s", "node-options": null, "noproxy": [ "" ], "offline": false, "omit": [], "omit-lockfile-registry-resolved": false, "only": null, "optional": null, "otp": null, "package": [], "package-lock": true, "package-lock-only": false, "pack-destination": ".", "parseable": false, "prefer-dedupe": false, "prefer-offline": false, "prefer-online": false, "prefix": "/Users/myusername/.nvm/versions/node/v18.20.1", "preid": "", "production": null, "progress": true, "provenance": false, "provenance-file": null, "proxy": null, "read-only": false, "rebuild-bundle": true, "replace-registry-host": "npmjs", "save": true, "save-bundle": false, "save-dev": false, "save-exact": false, "save-optional": false, "save-peer": false, "save-prefix": "^", "save-prod": false, "scope": "", "script-shell": null, "searchexclude": "", "searchlimit": 20, "searchopts": "", "searchstaleness": 900, "shell": "/bin/zsh", "shrinkwrap": true, "sign-git-commit": false, "sign-git-tag": false, "strict-peer-deps": false, "strict-ssl": true, "tag": "latest", "tag-version-prefix": "v", "timing": false, "umask": 0, "unicode": true, "update-notifier": true, "usage": false, "user-agent": "npm/{npm-version} node/{node-version} {platform} {arch} workspaces/{workspaces} {ci}", "userconfig": "/Users/myusername/.npmrc", "version": false, "versions": false, "viewer": "man", "which": null, "workspace": [], "workspaces": null, "workspaces-update": true, "yes": null, "npm-version": "10.5.0" } ```
Output of `yarn config --json | jq -s '.'` (similar command for yarn, and converting newline-delimited json to a json array) ```json [ { "key": "cacheFolder", "effective": "/Users/myusername/.yarn/berry/cache", "source": "", "description": "Folder where the cache files must be written", "type": "ABSOLUTE_PATH", "default": "./.yarn/cache" }, { "key": "cacheMigrationMode", "effective": "always", "source": "", "description": "Defines the conditions under which Yarn upgrades should cause the cache archives to be regenerated.", "type": "STRING", "values": ["always", "match-spec", "required-only"], "default": "always" }, { "key": "changesetBaseRefs", "effective": ["master", "origin/master", "upstream/master", "main", "origin/main", "upstream/main"], "source": "", "description": "The base git refs that the current HEAD is compared against when detecting changes. Supports git branches, tags, and commits.", "type": "STRING", "isArray": true, "isNullable": false, "default": ["master", "origin/master", "upstream/master", "main", "origin/main", "upstream/main"] }, { "key": "changesetIgnorePatterns", "effective": [], "source": "", "description": "Array of glob patterns; files matching them will be ignored when fetching the changed files", "type": "STRING", "default": [], "isArray": true }, { "key": "checksumBehavior", "effective": "throw", "source": "", "description": "Enumeration defining what to do when a checksum doesn't match expectations", "type": "STRING", "default": "throw" }, { "key": "cloneConcurrency", "effective": 2, "source": "", "description": "Maximal number of concurrent clones", "type": "NUMBER", "default": 2 }, { "key": "compressionLevel", "effective": 0, "source": "", "description": "Zip files compression level, from 0 to 9 or mixed (a variant of 9, which stores some files uncompressed, when compression doesn't yield good results)", "type": "NUMBER", "values": ["mixed", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "default": 0 }, { "key": "constraintsPath", "source": "", "description": "The path of the constraints file.", "type": "ABSOLUTE_PATH", "default": "./constraints.pro" }, { "key": "defaultLanguageName", "effective": "node", "source": "", "description": "Default language mode that should be used when a package doesn't offer any insight", "type": "STRING", "default": "node" }, { "key": "defaultProtocol", "effective": "npm:", "source": "", "description": "Default resolution protocol used when resolving pure semver and tag ranges", "type": "STRING", "default": "npm:" }, { "key": "defaultSemverRangePrefix", "effective": "^", "source": "", "description": "The default save prefix: '^', '~' or ''", "type": "STRING", "values": ["^", "~", ""], "default": "^" }, { "key": "deferredVersionFolder", "source": "", "description": "Folder where are stored the versioning files", "type": "ABSOLUTE_PATH", "default": "./.yarn/versions" }, { "key": "enableColors", "effective": false, "source": "", "description": "If true, the CLI is allowed to use colors in its output", "type": "BOOLEAN", "default": false, "defaultText": "" }, { "key": "enableConstraintsChecks", "effective": false, "source": "", "description": "If true, constraints will run during installs", "type": "BOOLEAN", "default": false }, { "key": "enableGlobalCache", "effective": true, "source": "", "description": "If true, the system-wide cache folder will be used regardless of `cache-folder`", "type": "BOOLEAN", "default": true }, { "key": "enableHardenedMode", "effective": null, "source": "", "description": "If true, automatically enable --check-resolutions --refresh-lockfile on installs", "type": "BOOLEAN", "default": null, "defaultText": "" }, { "key": "enableHyperlinks", "effective": false, "source": "", "description": "If true, the CLI is allowed to use hyperlinks in its output", "type": "BOOLEAN", "default": false, "defaultText": "" }, { "key": "enableImmutableCache", "effective": false, "source": "", "description": "If true, the cache is reputed immutable and actions that would modify it will throw", "type": "BOOLEAN", "default": false }, { "key": "enableImmutableInstalls", "effective": false, "source": "", "description": "If true (the default on CI), prevents the install command from modifying the lockfile", "type": "BOOLEAN", "default": false }, { "key": "enableInlineBuilds", "effective": false, "source": "", "description": "If true, the CLI will print the build output on the command line", "type": "BOOLEAN", "default": false, "defaultText": "" }, { "key": "enableInlineHunks", "effective": false, "source": "", "description": "If true, the installs will print unmatched patch hunks", "type": "BOOLEAN", "default": false }, { "key": "enableMessageNames", "effective": true, "source": "", "description": "If true, the CLI will prefix most messages with codes suitable for search engines", "type": "BOOLEAN", "default": true }, { "key": "enableMirror", "effective": true, "source": "", "description": "If true, the downloaded packages will be retrieved and stored in both the local and global folders", "type": "BOOLEAN", "default": true }, { "key": "enableNetwork", "effective": true, "source": "", "description": "If false, Yarn will refuse to use the network if required to", "type": "BOOLEAN", "default": true }, { "key": "enableOfflineMode", "effective": false, "source": "", "description": "If true, Yarn will attempt to retrieve files and metadata from the global cache rather than the network", "type": "BOOLEAN", "default": false }, { "key": "enableProgressBars", "effective": true, "source": "", "description": "If true, the CLI is allowed to show a progress bar for long-running events", "type": "BOOLEAN", "default": true, "defaultText": "" }, { "key": "enableScripts", "effective": true, "source": "", "description": "If true, packages are allowed to have install scripts by default", "type": "BOOLEAN", "default": true }, { "key": "enableStrictSettings", "effective": true, "source": "", "description": "If true, unknown settings will cause Yarn to abort", "type": "BOOLEAN", "default": true }, { "key": "enableStrictSsl", "effective": true, "source": "", "description": "If false, SSL certificate errors will be ignored", "type": "BOOLEAN", "default": true }, { "key": "enableTelemetry", "effective": true, "source": "", "description": "If true, telemetry will be periodically sent, following the rules in https://yarnpkg.com/advanced/telemetry", "type": "BOOLEAN", "default": true }, { "key": "enableTimers", "effective": true, "source": "", "description": "If true, the CLI is allowed to print the time spent executing commands", "type": "BOOLEAN", "default": true }, { "key": "enableTips", "effective": true, "source": "", "description": "If true, installs will print a helpful message every day of the week", "type": "BOOLEAN", "default": true, "defaultText": "" }, { "key": "enableTransparentWorkspaces", "effective": true, "source": "", "description": "If false, Yarn won't automatically resolve workspace dependencies unless they use the `workspace:` protocol", "type": "BOOLEAN", "default": true }, { "key": "globalFolder", "effective": "/Users/myusername/.yarn/berry", "source": "", "description": "Folder where all system-global files are stored", "type": "ABSOLUTE_PATH", "default": "/Users/myusername/.yarn/berry" }, { "key": "httpProxy", "effective": null, "source": "", "description": "URL of the http proxy that must be used for outgoing http requests", "type": "STRING", "default": null }, { "key": "httpRetry", "effective": 3, "source": "", "description": "Retry times on http failure", "type": "NUMBER", "default": 3 }, { "key": "httpTimeout", "effective": 60000, "source": "", "description": "Timeout of each http request in milliseconds", "type": "NUMBER", "default": 60000 }, { "key": "httpsCaFilePath", "effective": null, "source": "", "description": "A path to a file containing one or multiple Certificate Authority signing certificates", "type": "ABSOLUTE_PATH", "default": null }, { "key": "httpsCertFilePath", "effective": null, "source": "", "description": "Path to file containing certificate chain in PEM format", "type": "ABSOLUTE_PATH", "default": null }, { "key": "httpsKeyFilePath", "effective": null, "source": "", "description": "Path to file containing private key in PEM format", "type": "ABSOLUTE_PATH", "default": null }, { "key": "httpsProxy", "effective": null, "source": "", "description": "URL of the http proxy that must be used for outgoing https requests", "type": "STRING", "default": null }, { "key": "ignorePath", "effective": false, "source": "", "description": "If true, the local executable will be ignored when using the global one", "type": "BOOLEAN", "default": false }, { "key": "immutablePatterns", "effective": [], "source": "", "description": "Array of glob patterns; files matching them won't be allowed to change during immutable installs", "type": "STRING", "default": [], "isArray": true }, { "key": "initEditorConfig", "source": "", "description": "Extra rules to define in the generator editorconfig", "type": "MAP", "valueDefinition": { "description": "", "type": "ANY" } }, { "key": "initFields", "source": "", "description": "Additional fields to set when creating packages via the init command", "type": "MAP", "valueDefinition": { "description": "", "type": "ANY" } }, { "key": "initScope", "effective": null, "source": "", "description": "Scope used when creating packages via the init command", "type": "STRING", "default": null }, { "key": "injectEnvironmentFiles", "effective": [".env.yarn?"], "source": "", "description": "List of all the environment files that Yarn should inject inside the process when it starts", "type": "ABSOLUTE_PATH", "default": [".env.yarn?"], "isArray": true }, { "key": "installStatePath", "source": "", "description": "Path of the file where the install state will be persisted", "type": "ABSOLUTE_PATH", "default": "./.yarn/install-state.gz" }, { "key": "lastUpdateCheck", "effective": null, "source": "", "description": "Last timestamp we checked whether new Yarn versions were available", "type": "STRING", "default": null }, { "key": "logFilters", "effective": [], "source": "", "description": "Overrides for log levels", "type": "SHAPE", "isArray": true, "concatenateValues": true, "properties": { "code": { "description": "Code of the messages covered by this override", "type": "STRING" }, "text": { "description": "Code of the texts covered by this override", "type": "STRING" }, "pattern": { "description": "Code of the patterns covered by this override", "type": "STRING" }, "level": { "description": "Log level override, set to null to remove override", "type": "STRING", "values": ["error", "warning", "info", "discard"], "isNullable": true } } }, { "key": "networkConcurrency", "effective": 50, "source": "", "description": "Maximal number of concurrent requests", "type": "NUMBER", "default": 50 }, { "key": "networkSettings", "source": "", "description": "Network settings per hostname (glob patterns are supported)", "type": "MAP", "valueDefinition": { "description": "", "type": "SHAPE", "properties": { "httpsCaFilePath": { "description": "Path to file containing one or multiple Certificate Authority signing certificates", "type": "ABSOLUTE_PATH", "default": null }, "enableNetwork": { "description": "If false, the package manager will refuse to use the network if required to", "type": "BOOLEAN", "default": null }, "httpProxy": { "description": "URL of the http proxy that must be used for outgoing http requests", "type": "STRING", "default": null }, "httpsProxy": { "description": "URL of the http proxy that must be used for outgoing https requests", "type": "STRING", "default": null }, "httpsKeyFilePath": { "description": "Path to file containing private key in PEM format", "type": "ABSOLUTE_PATH", "default": null }, "httpsCertFilePath": { "description": "Path to file containing certificate chain in PEM format", "type": "ABSOLUTE_PATH", "default": null } } } }, { "key": "nmHoistingLimits", "effective": "none", "source": "", "description": "Prevents packages to be hoisted past specific levels", "type": "STRING", "values": ["workspaces", "dependencies", "none"], "default": "none" }, { "key": "nmMode", "effective": "classic", "source": "", "description": "Defines in which measure Yarn must use hardlinks and symlinks when generated `node_modules` directories.", "type": "STRING", "values": ["classic", "hardlinks-local", "hardlinks-global"], "default": "classic" }, { "key": "nmSelfReferences", "effective": true, "source": "", "description": "Defines whether the linker should generate self-referencing symlinks for workspaces.", "type": "BOOLEAN", "default": true }, { "key": "nodeLinker", "effective": "pnp", "source": "", "description": "The linker used for installing Node packages, one of: \"pnp\", \"pnpm\", or \"node-modules\"", "type": "STRING", "default": "pnp" }, { "key": "npmAlwaysAuth", "effective": false, "source": "", "description": "URL of the selected npm registry (note: npm enterprise isn't supported)", "type": "BOOLEAN", "default": false }, { "key": "npmAuditExcludePackages", "effective": [], "source": "", "description": "Array of glob patterns of packages to exclude from npm audit", "type": "STRING", "default": [], "isArray": true }, { "key": "npmAuditIgnoreAdvisories", "effective": [], "source": "", "description": "Array of glob patterns of advisory IDs to exclude from npm audit", "type": "STRING", "default": [], "isArray": true }, { "key": "npmAuditRegistry", "effective": null, "source": "", "description": "Registry to query for audit reports", "type": "STRING", "default": null }, { "key": "npmAuthIdent", "effective": null, "source": "", "description": "Authentication identity for the npm registry (_auth in npm and yarn v1)", "type": "SECRET", "default": null }, { "key": "npmAuthToken", "effective": null, "source": "", "description": "Authentication token for the npm registry (_authToken in npm and yarn v1)", "type": "SECRET", "default": null }, { "key": "npmPublishAccess", "effective": null, "source": "", "description": "Default access of the published packages", "type": "STRING", "default": null }, { "key": "npmPublishRegistry", "effective": null, "source": "", "description": "Registry to push packages to", "type": "STRING", "default": null }, { "key": "npmRegistries", "effective": {}, "source": "undefined, /Users/myusername/.yarnrc.yml", "description": "Settings per registry", "type": "MAP", "valueDefinition": { "description": "", "type": "SHAPE", "properties": { "npmAlwaysAuth": { "description": "URL of the selected npm registry (note: npm enterprise isn't supported)", "type": "BOOLEAN", "default": false }, "npmAuthIdent": { "description": "Authentication identity for the npm registry (_auth in npm and yarn v1)", "type": "SECRET", "default": null }, "npmAuthToken": { "description": "Authentication token for the npm registry (_authToken in npm and yarn v1)", "type": "SECRET", "default": null } } } }, { "key": "npmRegistryServer", "effective": "https://packages.mycompany.com/artifactory/api/npm/npm-remote", "source": "/Users/myusername/.yarnrc.yml", "description": "URL of the selected npm registry (note: npm enterprise isn't supported)", "type": "STRING", "default": "https://registry.yarnpkg.com" }, { "key": "npmScopes", "effective": {}, "source": "undefined, /Users/myusername/.yarnrc.yml", "description": "Settings per package scope", "type": "MAP", "valueDefinition": { "description": "", "type": "SHAPE", "properties": { "npmAlwaysAuth": { "description": "URL of the selected npm registry (note: npm enterprise isn't supported)", "type": "BOOLEAN", "default": false }, "npmAuthIdent": { "description": "Authentication identity for the npm registry (_auth in npm and yarn v1)", "type": "SECRET", "default": null }, "npmAuthToken": { "description": "Authentication token for the npm registry (_authToken in npm and yarn v1)", "type": "SECRET", "default": null }, "npmAuditRegistry": { "description": "Registry to query for audit reports", "type": "STRING", "default": null }, "npmPublishRegistry": { "description": "Registry to push packages to", "type": "STRING", "default": null }, "npmRegistryServer": { "description": "URL of the selected npm registry (note: npm enterprise isn't supported)", "type": "STRING", "default": "https://registry.yarnpkg.com" } } } }, { "key": "packageExtensions", "source": "", "description": "Map of package corrections to apply on the dependency tree", "type": "MAP", "valueDefinition": { "description": "The extension that will be applied to any package whose version matches the specified range", "type": "SHAPE", "properties": { "dependencies": { "description": "The set of dependencies that must be made available to the current package in order for it to work properly", "type": "MAP", "valueDefinition": { "description": "A range", "type": "STRING" } }, "peerDependencies": { "description": "Inherited dependencies - the consumer of the package will be tasked to provide them", "type": "MAP", "valueDefinition": { "description": "A semver range", "type": "STRING" } }, "peerDependenciesMeta": { "description": "Extra information related to the dependencies listed in the peerDependencies field", "type": "MAP", "valueDefinition": { "description": "The peerDependency meta", "type": "SHAPE", "properties": { "optional": { "description": "If true, the selected peer dependency will be marked as optional by the package manager and the consumer omitting it won't be reported as an error", "type": "BOOLEAN", "default": false } } } } } } }, { "key": "patchFolder", "source": "", "description": "Folder where the patch files must be written", "type": "ABSOLUTE_PATH", "default": "./.yarn/patches" }, { "key": "pnpEnableEsmLoader", "effective": false, "source": "", "description": "If true, Yarn will generate an ESM loader (`.pnp.loader.mjs`). If this is not explicitly set Yarn tries to automatically detect whether ESM support is required.", "type": "BOOLEAN", "default": false }, { "key": "pnpEnableInlining", "effective": true, "source": "", "description": "If true, the PnP data will be inlined along with the generated loader", "type": "BOOLEAN", "default": true }, { "key": "pnpFallbackMode", "effective": "dependencies-only", "source": "", "description": "If true, the generated PnP loader will follow the top-level fallback rule", "type": "STRING", "default": "dependencies-only" }, { "key": "pnpIgnorePatterns", "effective": [], "source": "", "description": "Array of glob patterns; files matching them will use the classic resolution", "type": "STRING", "default": [], "isArray": true }, { "key": "pnpMode", "effective": "strict", "source": "", "description": "If 'strict', generates standard PnP maps. If 'loose', merges them with the n_m resolution.", "type": "STRING", "default": "strict" }, { "key": "pnpShebang", "effective": "#!/usr/bin/env node", "source": "", "description": "String to prepend to the generated PnP script", "type": "STRING", "default": "#!/usr/bin/env node" }, { "key": "pnpUnpluggedFolder", "source": "", "description": "Folder where the unplugged packages must be stored", "type": "ABSOLUTE_PATH", "default": "./.yarn/unplugged" }, { "key": "preferDeferredVersions", "effective": false, "source": "", "description": "If true, running `yarn version` will assume the `--deferred` flag unless `--immediate` is set", "type": "BOOLEAN", "default": false }, { "key": "preferInteractive", "effective": false, "source": "", "description": "If true, the CLI will automatically use the interactive mode when called from a TTY", "type": "BOOLEAN", "default": false }, { "key": "preferReuse", "effective": false, "source": "", "description": "If true, `yarn add` will attempt to reuse the most common dependency range in other workspaces.", "type": "BOOLEAN", "default": false }, { "key": "preferTruncatedLines", "effective": false, "source": "", "description": "If true, the CLI will truncate lines that would go beyond the size of the terminal", "type": "BOOLEAN", "default": false }, { "key": "progressBarStyle", "source": "", "description": "Which style of progress bar should be used (only when progress bars are enabled)", "type": "STRING", "defaultText": "" }, { "key": "rcFilename", "effective": ".yarnrc.yml", "source": "", "description": "Name of the files where the configuration can be found", "type": "STRING", "default": ".yarnrc.yml" }, { "key": "supportedArchitectures", "effective": {}, "source": "", "description": "Architectures that Yarn will fetch and inject into the resolver", "type": "SHAPE", "properties": { "os": { "description": "Array of supported process.platform strings, or null to target them all", "type": "STRING", "isArray": true, "isNullable": true, "default": ["current"] }, "cpu": { "description": "Array of supported process.arch strings, or null to target them all", "type": "STRING", "isArray": true, "isNullable": true, "default": ["current"] }, "libc": { "description": "Array of supported libc libraries, or null to target them all", "type": "STRING", "isArray": true, "isNullable": true, "default": ["current"] } } }, { "key": "taskPoolConcurrency", "effective": 12, "source": "", "description": "Maximal amount of concurrent heavy task processing", "type": "NUMBER", "default": 12 }, { "key": "taskPoolMode", "effective": "workers", "source": "", "description": "Execution strategy for heavy tasks", "type": "STRING", "values": ["async", "workers"], "default": "workers" }, { "key": "telemetryInterval", "effective": 7, "source": "", "description": "Minimal amount of time between two telemetry uploads, in days", "type": "NUMBER", "default": 7 }, { "key": "telemetryUserId", "effective": null, "source": "", "description": "If you desire to tell us which project you are, you can set this field. Completely optional and opt-in.", "type": "STRING", "default": null }, { "key": "tsEnableAutoTypes", "effective": null, "source": "", "description": "Whether Yarn should auto-install @types/ dependencies on 'yarn add'", "type": "BOOLEAN", "isNullable": true, "default": null }, { "key": "unsafeHttpWhitelist", "effective": [], "source": "", "description": "List of the hostnames for which http queries are allowed (glob patterns are supported)", "type": "STRING", "default": [], "isArray": true }, { "key": "virtualFolder", "source": "", "description": "Folder where the virtual packages (cf doc) will be mapped on the disk (must be named __virtual__)", "type": "ABSOLUTE_PATH", "default": "./.yarn/__virtual__" }, { "key": "winLinkType", "effective": "junctions", "source": "", "description": "Whether Yarn should use Windows Junctions or symlinks when creating links on Windows.", "type": "STRING", "values": ["junctions", "symlinks"], "default": "junctions" }, { "key": "yarnPath", "effective": null, "source": "", "description": "Path to the local executable that must be used over the global one", "type": "ABSOLUTE_PATH", "default": null } ] ```
mrkwse commented 2 days ago

I'm having a similar issue when trying to use with a conventional package.json containing dependencies on (e.g.) @myorg/package (hosted on Azure DevOps artifacts) with .npmrc of (similarly obfuscated):

registry=https://pkgs.dev.azure.com/myorg/_packaging/team/npm/registry/
always-auth=true

; begin auth token
//pkgs.dev.azure.com/myorg/_packaging/team/npm/registry/:username=myorg
//pkgs.dev.azure.com/myorg/_packaging/team/npm/registry/:_password={base64token}
//pkgs.dev.azure.com/myorg/_packaging/team/npm/registry/:email=npm requires email to be set but doesn't use the value
//pkgs.dev.azure.com/myorg/_packaging/team/npm/:username=myorg
//pkgs.dev.azure.com/myorg/_packaging/team/npm/:_password={base64token}
//pkgs.dev.azure.com/myorg/_packaging/team/npm/:email=npm requires email to be set but doesn't use the value
; end auth token

This is a single .npmrc in the project root (same dir as package.json). deno install gives the following response as part of the 401 error, which suggests it isn't passing the username correctly:

{"$id":"1","innerException":null,"message":"TF400813: The user 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' is not authorized to access this resource.","typeName":"Microsoft.TeamFoundation.Framework.Server.UnauthorizedRequestException, Microsoft.TeamFoundation.Framework.Server","typeKey":"UnauthorizedRequestException","errorCode":0,"eventId":3000}

Edit: This was from the stable 2.0.0 version of deno and npm install works without issue