Yarn v1.0.1 on Win10-1703 x64, also Yarn v1.0.1 on macOS 10.12.16.
My feed is a VSTS npm feed, but I imagine this happens with other private feeds too.
- Create a new project with a
.npmrc file in it with
registry=https://companyname.pkgs.visualstudio.com/_packaging/FeedName/npm/registry
always-auth=true
- Edit your local
.npmrc file to have auth tokens in e.g.
; Treat this auth token like a password. Do not share it with anyone, including Microsoft support. This token expires on or before 12/11/2017.
; begin auth token
//companyname.pkgs.visualstudio.com/_packaging/FeedName/npm/registry/:_authToken=ey...
//companyname.pkgs.visualstudio.com/_packaging/FeedName/npm/:_authToken=ey...
; end auth token
N.B. trailing slash in auth token path.
-
yarn install
-
See 401 errors:
[1/4] Resolving packages...
verbose 1.275 Performing "GET" request to "https://companyname.pkgs.visualstudio.com/_packaging/FeedName/npm/body-parser".
verbose 1.465 Request "https://companyname.pkgs.visualstudio.com/_packaging/FeedName/npm/body-parser" finished with status code 401.
verbose 1.466 Error: Couldn't find package "body-parser" on the "npm" registry.
at C:\Program Files (x86)\Yarn\lib\cli.js:48169:15
at Generator.next (<anonymous>)
at step (C:\Program Files (x86)\Yarn\lib\cli.js:92:30)
at C:\Program Files (x86)\Yarn\lib\cli.js:103:13
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:169:7)
error Couldn't find package "body-parser" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
A fix is to make sure that the registry path matches exactly the path of the auth token. In this instance, it just needs a trailing slash.
Interestingly, if the auth token doesn't have the trailing slash, but the registry does, this works fine. Almost as if it's a non-commutative equality!!
This works fine either way with npm install. If I had to guess, I'd say it's trimming (or adding) trailing /'s on the URL on the registry, but not the authtoken.
Yarn v1.0.1 on Win10-1703 x64, also Yarn v1.0.1 on macOS 10.12.16.
My feed is a VSTS npm feed, but I imagine this happens with other private feeds too.
.npmrcfile in it with.npmrcfile to have auth tokens in e.g.N.B. trailing slash in auth token path.
yarn installSee 401 errors:
A fix is to make sure that the
registrypath matches exactly the path of the auth token. In this instance, it just needs a trailing slash.Interestingly, if the auth token doesn't have the trailing slash, but the registry does, this works fine. Almost as if it's a non-commutative equality!!
This works fine either way with
npm install. If I had to guess, I'd say it's trimming (or adding) trailing /'s on the URL on the registry, but not the authtoken.