Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Get a package with optionnalDependencies from private registry. Get private package with cpu and os specified. #7601

Open
2 tasks done
Dafyh opened this issue Jun 19, 2024 · 0 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@Dafyh
Copy link

Dafyh commented Jun 19, 2024

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 use a private Gitlab registry to publish my packages. When I install a package that has optionalDependencies, they do not get installed. If I have a private package that contains os and cpu fields, it gets installed even if I'm not on the right platform.

Expected Behavior

The behavior should be the same as usual, which means installing the optionalDependencies and/or, in the case of a package with cpu and os fields specified, installing or not installing it on the platform (Windows/Linux) according to the fields specified in the package.json.

Steps To Reproduce

Let's say I have the following private package, @foo/bar, which contains private optionalDependencies @foo/bar.linux-x64 and @foo/bar.win32-x64 :

@foo/bar

{
  "name": "@foo/bar",
  "version": "0.0.1",
  "publishConfig": {
    "@foo:registry": "https://private-gitlab-registry.com/"
  },
  "optionalDependencies": {
    "@foo/bar.linux-x64": "^0.0.1",
    "@foo/bar.win32-x64": "^0.0.1"
  }
}

@foo/bar.linux-x64

{
  "name": "@foo/bar.linux-x64",
  "version": "0.0.1",
  "publishConfig": {
    "@foo:registry": "https://private-gitlab-registry.com/"
  },
  "os": [
    "linux"
  ],
  "cpu": [
    "x64"
  ]
}

@foo/bar.win32-x64

{
  "name": "@foo/bar.win32-x64",
  "version": "0.0.1",
  "publishConfig": {
    "@foo:registry": "https://private-gitlab-registry.com/"
  },
  "os": [
    "win32"
  ],
  "cpu": [
    "x64"
  ]
}

First point => If, in another project, I run npm i @foo/bar, @foo/bar installs correctly but the optionalDependencies do not. I don't get any info with --verbose, they simply are not GET.

Second point => If I install npm i @foo/bar.linux-x64 on a Windows platform, the package installs and I don't get any platform-related errors.

Environment

  • npm: 10.7.0
  • Node.js: 20.6.0
  • OS Name: Windows x64
  • npm config:
; "builtin" config from C:\Users\Boz\AppData\Roaming\npm\node_modules\npm\npmrc

prefix = "C:\\Users\\Boz\\AppData\\Roaming\\npm"

; "user" config from C:\Users\Boz\.npmrc

@foo:registry = "https://gitlab.com/api/v4/packages/npm/"
//gitlab.com/api/v4/packages/npm/:_authToken = (protected)
//registry.npmjs.org/:_authToken = (protected)
registry = "https://registry.npmjs.org/"

; "project" config from C:\foo\bar\.npmrc

package-lock = false

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v20.6.0
; npm local prefix = C:\foo\bar
; npm version = 10.7.0
; cwd = C:\foo\bar
; HOME = C:\Users\Boz
; Run `npm config ls -l` to show all defaults.

; "publishConfig" from C:\foo\bar\package.json
; This set of config values will be used at publish-time.

@foo:registry = "https://private-registry.com/"
@Dafyh Dafyh added Bug thing that needs fixing Needs Triage needs review for next steps labels Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps
Projects
None yet
Development

No branches or pull requests

1 participant