Skip to content

[BUG] publishConfig.registry in package.json should take higher priority than project level .npmrc #7043

Closed as not planned
@JounQin

Description

@JounQin

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

For example, If I have publishConfig.registry = registryA in @scope/foo's package.json, and $cwd/.npmrc with @scope:registry=registryB, when I run npm publish on @scope/foo, I'd expect to publish it to registryA instead of registryB.

However, the current behavior is unexpected to publish on registryB.

Expected Behavior

As title

Steps To Reproduce

As described above

Environment

  • npm: 9.8.1
  • Node.js: v18.18.2
  • OS Name: Darwin arm64
  • System Model Name: macOS 14.1.2
  • npm config:
; "user" config from /Users/JounQin/.npmrc

//internal-mirrors.alauda.cn/repository/npm/:_authToken = (protected) 
//registry.npmjs.org/:_authToken = (protected) 

; "project" config from /Users/JounQin/Workspaces/Alauda/octopus/.npmrc

@alauda/dp-cli:registry = "https://registry.npmjs.org/"
@alauda/dp-dynamic-plugin-backend-core:registry = "https://registry.npmjs.org/"
@alauda/dp-dynamic-plugin-frontend-core:registry = "https://registry.npmjs.org/"
@alauda:registry = "https://build-nexus.alauda.cn/repository/npm/"

; node bin location = /Users/JounQin/Library/Application Support/fnm/node-versions/v18.18.2/installation/bin/node
; node version = v18.18.2
; npm local prefix = /Users/JounQin/Workspaces/Alauda/octopus
; npm version = 9.8.1
; cwd = /Users/JounQin/Workspaces/Alauda/octopus
; HOME = /Users/JounQin
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions