npm / npm/cli

[BUG] Unable to download tarball of private packages

Open
#5,191 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug 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

I'm unable to use the npm pack command to download the the tarball of npm packages I have published on my private GitLab package registry:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://gitlab.<...>/api/v4/projects/87/packages/npm/@<...>/-/@<...>-2.1.1.tgz
npm ERR! 404 
npm ERR! 404  'https://gitlab.<...>/api/v4/projects/87/packages/npm/@<...>/-/@<...>-2.1.1.tgz' is not in this registry.
npm ERR! 404 This package name is not valid, because 
npm ERR! 404  1. name can only contain URL-friendly characters
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/<...>/.npm/_logs/2022-07-19T19_07_44_458Z-debug-0.log

When I first do a npm install -g before, it downloads the package on cache, using the credentials I set on the .npmrc file, and then the npm pack command works as expected afterwards.

Expected Behavior

Directly download the tarball of private packages using npm pack, considering the credentials set on .npmrc file, without the need of executing the npm install -g command before to save it on cache.

Environment
  • npm: 8.14.0
  • Node.js: v16.14.0
  • OS Name: Kubuntu 22.04

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

Reproduce the failure with npm 8.14.0 and Node.js 16.14.0 using npm pack against the private GitLab package registry, with credentials configured in .npmrc. Compare this with npm install -g, which populates the cache, and trace the package-fetch path involved. Done means npm pack downloads the private tarball directly without requiring a prior install.

Written by the indexing model from the issue text.

Assessment

Tech stack
gitlab, javascript, nodejs
Domain
cli, tooling
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.