I am using the Google Artifact registry for private node modules. The private modules have the scope "@myscope" and this is, what I have in my .npmrc:
@myscope:registry=https://europe-west3-npm.pkg.dev/my-project/frontend/
//europe-west3-npm.pkg.dev/my-project/frontend/:_password="eW..E="
//europe-west3-npm.pkg.dev/my-project/frontend/:username=oauth2accesstoken
//europe-west3-npm.pkg.dev/my-project/frontend/:email=not.valid@email.com
//europe-west3-npm.pkg.dev/my-project/frontend/:always-auth=true
I have a project "test" with a dependency "@myscope/testdependency", this is the package.json:
{
"dependencies": {
"@myscope/testdependency": "^1.2.5"
}
}
When I run a yarn install --verbose, I see this:
...
[1/4] Resolving packages...
verbose 0.23567398 Performing "GET" request to "https://europe-west3-npm.pkg.dev/my-project/frontend/@myscope%2ftestdependency".
verbose 0.381522173 Request "https://europe-west3-npm.pkg.dev/my-project/frontend/@myscope%2ftestdependency" finished with status code 200.
[2/4] Fetching packages...
verbose 0.406426655 Performing "GET" request to "https://registry.yarnpkg.com/@myscope/testdependency/-/@myscope/testdependency-1.2.5.tgz".
verbose 0.86999269 Error: https://registry.yarnpkg.com/@myscope/testdependency/-/@myscope/testdependency-1.2.5.tgz: Request failed "404 Not Found"
...
So the resolving part looks correct, but the actual fetching ignores my setting.
This is my yarn config:
info yarn config
{
'version-tag-prefix': 'v',
'version-git-tag': true,
'version-commit-hooks': true,
'version-git-sign': false,
'version-git-message': 'v%s',
'init-version': '1.0.0',
'init-license': 'MIT',
'save-prefix': '^',
'bin-links': true,
'ignore-scripts': false,
'ignore-optional': false,
registry: 'https://registry.yarnpkg.com',
'strict-ssl': true,
'user-agent': 'yarn/1.22.17 npm/? node/v12.16.3 linux x64',
'@myscope:registry': 'https://europe-west3-npm.pkg.dev/my-project/frontend/',
lastUpdateCheck: 1645016355470
}
info npm config
{
'@myscope:registry': 'https://europe-west3-npm.pkg.dev/my-project/frontend/',
'//europe-west3-npm.pkg.dev/my-project/frontend/:_password': 'eW...E=',
'//europe-west3-npm.pkg.dev/my-project/frontend/:username': 'oauth2accesstoken',
'//europe-west3-npm.pkg.dev/my-project/frontend/:email': 'not.valid@email.com',
'//europe-west3-npm.pkg.dev/my-project/frontend/:always-auth': true
}
What is even more strange is that npm is also trying to get this package from the yarn registry. This is the output of npm install --verbose
...
npm http fetch GET 200 https://europe-west3-npm.pkg.dev/my-project/frontend/@myscope%2ftestdependency 156ms
npm http fetch GET 404 https://registry.yarnpkg.com/@myscope/testdependency/-/@myscope/testdependency-1.2.5.tgz 319ms
npm http fetch GET 404 https://registry.yarnpkg.com/@myscope/testdependency/-/@myscope/testdependency-1.2.5.tgz 244ms
npm timing stage:rollbackFailedOptional Completed in 1ms
npm timing stage:runTopLevelLifecycles Completed in 773ms
npm verb stack Error: 404 Not Found - GET https://registry.yarnpkg.com/@myscope/testdependency/-/@myscope/testdependency-1.2.5.tgz
...
Similar situation. There is a successful request to the private registry, but then it tries fetching it from the yarn registry.
This is the output of npm config ls -l | grep registry:
metrics-registry = "https://registry.npmjs.org/"
@myscope:registry = "https://europe-west3-npm.pkg.dev/my-project/frontend/"
; metrics-registry = null (overridden)
registry = "https://registry.npmjs.org/"
We also tried it on a machine of a colleague. Same result.
yarn version: 1.22.17
npm version: 6.14.4
Any ideas about what is going wrong here?
Update: I tried the npmjs registry instead of Google Artifact and it is working fine with it. So it is most likely a problem related to Google