[Bug?]: Project specific .yarnrc.yml npmAlwaysAuth not respected
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Self-service
- I'd be willing to implement a fix
Describe the bug
In the project I have the following .yarnrc.yml:
httpTimeout: 30000
nodeLinker: node-modules
npmAlwaysAuth: true
npmRegistryServer: 'https://company.xyz/api/npm/registry'
npmPublishRegistry: 'https://company.xyz/api/npm/registry'
yarnPath: .yarn/releases/yarn-4.5.0.cjs
yarn npm login is successful but when running yarn npm info lodash I get an error
➤ YN0041: Invalid authentication (as an anonymous user)
If I add the npmAlwaysAuth to the registry specific config in ~/.yarnrc.yml, the npm info works. My ~/.yarnrc.yml:
npmRegistries:
"https://company.xyz/api/npm/registry":
npmAlwaysAuth: true # This is required
npmAuthToken: ***
It seems to also work if I add this to project .yarnrc.yml:
npmRegistries:
'https://company.xyz/api/npm/registry':
npmAlwaysAuth: true
Shouldn't the top level npmAlwaysAuth in the project force the authentication for all requests to all registeries like wanted?
To reproduce
See description above.
Environment
System:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 18.19.0 - /private/var/folders/jx/6_rpw_wd31bc2sxg5brx5j780000gn/T/xfs-25f595b7/node
Yarn: 4.5.0 - /private/var/folders/jx/6_rpw_wd31bc2sxg5brx5j780000gn/T/xfs-25f595b7/yarn
npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with project .yarnrc.yml and ~/.yarnrc.yml using yarn npm login followed by yarn npm info lodash. Trace how Yarn 4.5.0 reads top-level npmAlwaysAuth versus the npmRegistries entry, then add or update coverage for the expected project-level authentication behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100