npm / npm/cli

[BUG] npm pack fails for scoped package from private registry when it's not in the cache

Open
#4,708 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug config:private-registry Needs Triage Release 8.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

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

Since version 7.x if the scoped package is not present in the cache the command "npm pack @foo/bar@baz" returns a 404 error.

Refer to this issue : #2918

Expected Behavior

The command "npm pack @foo/bar@baz" work again with scoped package like npm 6.14.

Steps To Reproduce
  1. Create package with scope like "@foo/bar" in version 1.0.0
  2. On a server that has never installed this package, try using the command "npm pack @foo/bar@1.0.0"
  3. A 404 error occurs.
  4. However, if you do "npm i @foo/bar@1.0.0" it works without error.
  5. Try using the "npm pack @foo/bar@1.0.0" command again
  6. it will work without error.
  7. now try to use "npm cache clean --force"
  8. Try using the "npm pack @foo/bar@1.0.0" command again
  9. A 404 error occurs.
Environment
  • npm: 8.5.5
  • Node.js: 17.8.0
  • OS Name: ubuntu (20.04) macos (latest) windows (latest)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the scoped-package case with npm pack against a private registry, then compare it with npm install and the behavior after npm cache clean --force. Trace the npm CLI entry points for pack, install, and cache handling to identify where the uncached package path diverges. Done means npm pack @foo/bar@1.0.0 succeeds on a clean cache without the 404.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.