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

[BUG] "npm install" not working for private artifactories #2008

Closed
dnalborczyk opened this issue Oct 21, 2020 · 4 comments
Closed

[BUG] "npm install" not working for private artifactories #2008

dnalborczyk opened this issue Oct 21, 2020 · 4 comments
Assignees
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release

Comments

@dnalborczyk
Copy link

dnalborczyk commented Oct 21, 2020

Current Behavior:

npm install with npm v7.0.2 throws the following exception (verbose log):

➜ npm i graphql --verbose
npm verb cli [
npm verb cli   '/Users/daniel/.nvs/node/15.0.0/x64/bin/node',
npm verb cli   '/Users/daniel/.nvs/node/15.0.0/x64/bin/npm',
npm verb cli   'i',
npm verb cli   'graphql',
npm verb cli   '--verbose'
npm verb cli ]
npm info using npm@7.0.2
npm info using node@v15.0.0
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:/Users/daniel/.nvs/node/15.0.0/x64/lib/node_modules/npm/npmrc Completed in 1ms
npm timing config:load:builtin Completed in 1ms
npm timing config:load:cli Completed in 1ms
npm timing config:load:env Completed in 1ms
npm timing config:load:file:/Users/daniel/redacted/test/npm-7/.npmrc Completed in 0ms
npm timing config:load:project Completed in 0ms
npm timing config:load:file:/Users/daniel/.npmrc Completed in 1ms
npm timing config:load:user Completed in 2ms
npm timing config:load:file:/Users/daniel/.nvs/node/15.0.0/x64/etc/npmrc Completed in 0ms
npm timing config:load:global Completed in 0ms
npm timing config:load:cafile Completed in 0ms
npm timing config:load:validate Completed in 2ms
npm timing config:load:setUserAgent Completed in 0ms
npm timing config:load:setEnvs Completed in 1ms
npm timing config:load Completed in 9ms
npm verb npm-session 8e4eb2e06a0ea959
npm timing npm:load Completed in 19ms
npm timing arborist:ctor Completed in 0ms
npm timing idealTree:init Completed in 17ms
npm timing idealTree:userRequests Completed in 2ms
npm http fetch GET 401 https://redacted.jfrog.io/artifactory/api/npm/npm-prod/graphql 235ms
npm timing idealTree:#root Completed in 242ms
npm timing idealTree:node_modules/graphql Completed in 0ms
npm timing idealTree:buildDeps Completed in 243ms
npm timing idealTree:fixDepFlags Completed in 1ms
npm timing idealTree Completed in 263ms
npm timing command:install Completed in 266ms
npm verb stack Error: Unable to authenticate, need: Basic realm="Artifactory Realm"
npm verb stack     at /Users/daniel/.nvs/node/15.0.0/x64/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:113:17
npm verb stack     at processTicksAndRejections (node:internal/process/task_queues:93:5)
npm verb stack     at async Arborist.[buildDepStep] (/Users/daniel/.nvs/node/15.0.0/x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:760:11)
npm verb stack     at async Arborist.buildIdealTree (/Users/daniel/.nvs/node/15.0.0/x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:202:7)
npm verb stack     at async Promise.all (index 1)
npm verb stack     at async Arborist.reify (/Users/daniel/.nvs/node/15.0.0/x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:121:5)
npm verb stack     at async install (/Users/daniel/.nvs/node/15.0.0/x64/lib/node_modules/npm/lib/install.js:40:5)
npm verb statusCode 401
npm verb pkgid graphql@*
npm verb cwd /Users/daniel/redacted/test/npm-7
npm verb Darwin 19.6.0
npm verb argv "/Users/daniel/.nvs/node/15.0.0/x64/bin/node" "/Users/daniel/.nvs/node/15.0.0/x64/bin/npm" "i" "graphql" "--verbose"
npm verb node v15.0.0
npm verb npm  v7.0.2
npm ERR! code E401
npm ERR! Incorrect or missing password.
npm ERR! If you were trying to login, change your password, create an
npm ERR! authentication token or enable two-factor authentication then
npm ERR! that means you likely typed your password in incorrectly.
npm ERR! Please try again, or recover your password at:
npm ERR!     https://www.npmjs.com/forgot
npm ERR! 
npm ERR! If you were doing some other operation then your saved credentials are
npm ERR! probably out of date. To correct this please try logging in again with:
npm ERR!     npm login
npm verb exit 1
npm timing npm Completed in 602ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/daniel/.npm/_logs/2020-10-21T17_23_26_626Z-debug.log

.npmrc:

_auth="redacted=="
always-auth=true
email=redacted@redacted.me
registry=https://redacted.jfrog.io/artifactory/api/npm/npm-prod/
@redacted:registry=https://redacted.jfrog.io/artifactory/api/npm/npm-prod/

Expected Behavior:

should just work. the above works with npm v6+

Steps To Reproduce:

see above

Environment:

macOS Catalina 10.15.6
node.js v15.0.0 (but also reproduces with node.js v14.14.0 and a global npm upgrade to v7)
npm v7.0.2

if it matters:
nvs v1.6.0

@dnalborczyk dnalborczyk added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Oct 21, 2020
@aukevanleeuwen
Copy link

Have the same thing. Changed my configuration to use username and _password rather than _auth and that seems to work.

registry=https://redacted.jfrog.io/artifactory/api/npm/npm/
username=redacted@redacted.me
_password=redacted==
email=redacted@redacted.me
always-auth=true

@ruyadorno ruyadorno removed the Needs Triage needs review for next steps label Nov 9, 2020
@ruyadorno ruyadorno self-assigned this Nov 9, 2020
@ruyadorno ruyadorno added this to the OSS - Sprint 19 milestone Nov 9, 2020
ruyadorno added a commit to ruyadorno/cli that referenced this issue Nov 10, 2020
Add legacy `_auth` token to flatOptions in order to support it when
reaching out to registries.

Fixes: npm#2008
@stefankraus-wf
Copy link

The solution posted by @aukevanleeuwen does not seem to work with email address usernames, even when urlencoding the @ symbol. #2153 looks like it will fix the issue. Until then, I have users that run into this issue downgrade to npm 6.X
Thanks for getting the fix in review so quickly @ruyadorno !

darcyclarke pushed a commit that referenced this issue Nov 13, 2020
Add legacy `_auth` token to flatOptions in order to support it when
reaching out to registries.

Fixes: #2008

Credit: @ruyadorno
Close: #2153
Reviewed-by: @isaacs
@isaacs isaacs closed this as completed in 2a80c67 Nov 13, 2020
@tremblaysimon
Copy link

Like I said in the PR comments a couple of days ago, I think the PR #2153 has never been merged so I think that issue shouldn't be closed.

@ljharb
Copy link
Contributor

ljharb commented Apr 15, 2021

@tremblaysimon the commit referenced above indicates it's in v7.0.11+.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants