Skip to content

[BUG] npm unpublish fails if scope is involved #5685

Closed

Description

@JoFrMueller

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

The following command fails if .npmrc contains @someScope:registry=https://some.npm.registry/

npm unpublish @someScope/somePackage@0.1.2-beta3

The command works though if .npmrc contains registry=https://some.npm.registry/

The weird thing is npm publish for the same package works if .npmrc contains @someScope:registry=https://some.npm.registry/

Expected Behavior

The npm unpublish command should work like the npm publish command if package scope is defined.

Steps To Reproduce

  1. In any NPM 8.19.2 environment with NodeJS 16.17.1 on Windows 11
  2. With some custom package and custom registry that is not https://registry.npmjs.org with .npmrc containing @someScope:registry=https://some.npm.registry/
  3. Run npm unpublish @someScope/somePackage@0.1.2-beta3
  4. See the following error:

npm ERR! 404 Not Found - GET https://registry.npmjs.org/@someScope%2fsomePackage - Not found
npm ERR! 404
npm ERR! 404 '@someScope/somePackage' is not in this registry.

This is correct, though the package clearly is in the custom registry. And switching from @someScope:registry=https://some.npm.registry/ to registry=https://some.npm.registry/ makes unpublish work again.

Environment

  • npm: 8.19.2
  • Node.js: 16.17.1
  • OS Name: Windows 11
  • System Model Name: Irrelevant
  • npm config:
@someScope:registry = "https://some.npm.registry/"
//some.npm.registry/:_authToken = (protected)

Activity

  1. added
    Bugthing that needs fixing
    Needs Triageneeds review for next steps
    Release 8.xwork is associated with a specific npm 8 release
    on Oct 12, 2022
  2. marcelo-michels commented on Oct 17, 2022

    @marcelo-michels

    Same problem here

    • npm: 8.19.2
    • Node.js: 18.11.0
    • OS Name: Mac OS
    • .npmrc
    @my-org:registry=https://npm.pkg.github.com/my-org
    
  3. added and removed
    Needs Triageneeds review for next steps
    on Oct 18, 2022
  4. jkupcho commented on Nov 3, 2022

    @jkupcho

    It appears that this bug started in npm version 8.3.1.

    Release:
    https://github.com/npm/cli/releases/tag/v8.3.1
    Code surrounding unpublish specifically:
    2ac540b

  5. self-assigned this
    on Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 8.xwork is associated with a specific npm 8 release

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions