Open
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 using Gitlab as a private npm registry, and got an unexpected log output from npm that is confusing me.
When running:
npm view @myscope/not-published-yet
it seems like npm is not respecting the registry that is defined for @myscope
in .npmrc
(see example below).
Expected Behavior
I expected that npm would check in the specified registry (still return a 404 though).
Steps To Reproduce
In my .npmrc
, I've got this:
//gitlab.internal.com/api/v4/packages/npm/:_authToken = (protected)
@myscope:registry=https://gitlab.internal.com/api/v4/packages/npm
When running npm view
for a package that is not yet published to the internal registry (neither to the public npm registry), it seems like npm is not respecting the registry for the specified scope, i.e:
$ npm view @myscope/not-published-yet --verbose
npm verbose cli /usr/bin/node /home/theuser/.npm/bin/npm
npm info using [email protected]
npm info using [email protected]
npm verbose title npm view @myscope/not-published-yet
npm verbose argv "view" "@myscope/not-published-yet" "--loglevel" "verbose"
npm verbose logfile logs-max:10 dir:/home/theuser/.npm/cache/_logs/2025-02-12T07_48_15_403Z-
npm verbose logfile /home/theuser/.npm/cache/_logs/2025-02-12T07_48_15_403Z-debug-0.log
npm http fetch GET 404 https://registry.npmjs.org/@myscope/not-published-yet 791ms (cache skip)
npm verbose stack HttpErrorGeneral: 404 Not Found - GET https://registry.npmjs.org/@myscope/not-published-yet - Not found
npm verbose stack at /home/theuser/.npm/lib/node_modules/npm/node_modules/npm-registry-fetch/lib/check-response.js:103:15
npm verbose stack at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm verbose stack at async RegistryFetcher.packument (/home/theuser/.npm/lib/node_modules/npm/node_modules/pacote/lib/registry.js:90:19)
npm verbose stack at async #getData (/home/theuser/.npm/lib/node_modules/npm/lib/commands/view.js:135:20)
npm verbose stack at async #viewPackage (/home/theuser/.npm/lib/node_modules/npm/lib/commands/view.js:112:28)
npm verbose stack at async View.exec (/home/theuser/.npm/lib/node_modules/npm/lib/commands/view.js:70:5)
npm verbose stack at async Npm.exec (/home/theuser/.npm/lib/node_modules/npm/lib/npm.js:207:9)
npm verbose stack at async module.exports (/home/theuser/.npm/lib/node_modules/npm/lib/cli/entry.js:67:5)
npm verbose statusCode 404
npm verbose pkgid @myscope/not-published-yet@*
npm error code E404
npm error 404 Not Found - GET https://registry.npmjs.org/@myscope/not-published-yet - Not found
npm error 404
npm error 404 '@myscope/not-published-yet@*' is not in this registry.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
npm verbose cwd /home/theuser/dev/flyg/llf/llf-ws
npm verbose os Linux 5.14.0-503.22.1.el9_5.x86_64
npm verbose node v20.17.0
npm verbose npm v11.1.0
npm verbose exit 1
npm verbose code 1
npm error A complete log of this run can be found in: /home/theuser/.npm/cache/_logs/2025-02-12T07_48_15_403Z-debug-0.log
Environment
- npm: 11.1.0
- Node.js: v20.17.0
- OS Name: Red Hat Enterprise Linux 9.5 (Plow)
- System Model Name: Lenovo ThinkPad T14 Gen 4
- npm config:
; "global" config from /etc/npmrc
; prefix = "/usr/local" ; overridden by user
python = "/usr/bin/python3"
; "user" config from /home/theuser/.npmrc
//gitlab.internal.com/api/v4/packages/npm/:_authToken = (protected)
cache = "/home/theuser/.npm/cache"
prefix = "/home/theuser/.npm"
; "project" config from /home/theuser/path/to/project/.npmrc
@myscope:registry = "https://gitlab.internal.com/api/v4/packages/npm"
; node bin location = /usr/bin/node
; node version = v20.17.0
; npm local prefix = /home/theuser/path/to/project
; npm version = 11.1.0
; cwd = /home/theuser/path/to/project
; HOME = /home/theuser
; Run `npm config ls -l` to show all defaults.
Activity