Docs feedback: yarn needs an additional auth entry to work with the GitLab NPM Registry
I followed the documentation on https://docs.gitlab.com/ee/user/project/packages/npm_registry.html#authenticating-with-an-oauth-token to install a custom package from my companies private repos. This worked really well with npm but with yarn I always ended up with the same error message:
yarn install v1.15.2
warning package.json: No license field
info No lockfile found.
warning XXX: No license field
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
error An unexpected error occurred: "https://gitlab.com/api/v4/projects/XXX/packages/npm/XXX/XXX/-/XXX/XXX-X.X.X.tgz: Request failed \"404 Not Found\"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/XXX/gitlab-migration/module-util/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command
The issue finally went away after I added the line
//gitlab.com/api/v4/projects/:_authToken=<your_oauth_token>
to my .npmrc file. I have no idea why this seems to be required or why it even works but this might be helpful for other users running into the same issue.