-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[BUG] npm view does not respect registry for @scope in .npmrc #8103
Comments
From config I could see scoped registry is configured at project level As you can check the logs it's picking up scoped registry config from .npmrc file. ~/workarea/rep $ npm view @myscope/not-published-yet -ddd
npm verbose cli /Users/milaninfy/.nvm/versions/node/v22.13.1/bin/node /Users/milaninfy/.nvm/versions/node/v22.13.1/bin/npm
npm info using npm@11.1.0
npm info using node@v22.13.1
npm silly config load:file:/Users/milaninfy/.nvm/versions/node/v22.13.1/lib/node_modules/npm/npmrc
npm silly config load:file:/Users/milaninfy/workarea/rep/.npmrc
npm silly config load:file:/Users/milaninfy/.npmrc
npm silly config load:file:/Users/milaninfy/.nvm/versions/node/v22.13.1/etc/npmrc
npm verbose title npm view @myscope/not-published-yet
npm verbose argv "view" "@myscope/not-published-yet" "--loglevel" "silly"
npm verbose logfile logs-max:10 dir:/Users/milaninfy/.npm/_logs/2025-02-12T15_00_22_946Z-
npm verbose logfile /Users/milaninfy/.npm/_logs/2025-02-12T15_00_22_946Z-debug-0.log
npm silly logfile start cleaning logs, removing 3 files
npm silly logfile done cleaning log files
npm http fetch GET https://gitlab.internal.com/api/v4/packages/npm/@myscope%2fnot-published-yet attempt 1 failed with ERR_SSL_WRONG_VERSION_NUMBER
npm http fetch GET https://gitlab.internal.com/api/v4/packages/npm/@myscope%2fnot-published-yet attempt 2 failed with ERR_SSL_WRONG_VERSION_NUMBER
⠏ |
I am not getting the same behaviour as you @milaninfy . If I run the same command, the output clearly shows that npm is trying to find the package in https://registry.npmjs.org:
I don't see what could differ here. What am I missing? |
Can you check the location of your |
Currently, I've put the (username and internal gitlab url is modified to not expose things that should not be exposed) $ pwd
/tmp/npm-scope $ ls -lAo
total 4
-rw-rw-r--. 1 theuser 62 Feb 14 12:48 .npmrc $ cat .npmrc
@myscope:registry=https://gitlab.internal.com/api/v4/packages/npm $ npm config ls
; "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"
init.author = "Jonas Thoursie"
prefix = "/home/theuser/.npm"
; "project" config from /tmp/npm-scope/.npmrc
@myscope:registry = "https://gitlab.internal.com/api/v4/packages/npm"
; node bin location = /usr/bin/node
; node version = v20.18.2
; npm local prefix = /tmp/npm-scope
; npm version = 11.1.0
; cwd = /tmp/npm-scope
; HOME = /home/theuser
; Run `npm config ls -l` to show all defaults. |
If you are running a command where your ~/workarea/rep $ npm view @scope/somepkg -dddd
npm info using npm@11.1.0
npm info using node@v22.13.1
npm http fetch GET http://www.non-existant-registry.npmjs.com/@scope%2fsomepkg attempt 1 failed with ENOTFOUND
⠴^C
~/workarea/rep $ cat .npmrc
@scope:registry="http://www.non-existant-registry.npmjs.com" |
Is there an existing issue for this?
This issue exists in the latest npm version
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:
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: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:Environment
The text was updated successfully, but these errors were encountered: