Skip to content

pnpm install multiple bindings of different libc #7362

Closed

Description

@Timeless0911

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

latest

Which area(s) of pnpm are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

No response

Reproduction steps

Just init an empty package.json as follows

{
  "name": "pnpm",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@rspack/binding": "latest"
  },
  "pnpm": {
    "supportedArchitectures": {
      "os": [
        "linux"
      ],
      "cpu": [
        "x64"
      ],
      "libc": [
        "glibc"
      ]
    }
  }
}

Describe the Bug

Run pnpm install, you will find both binding-linux-x64-gnu and binding-linux-x64-musl in .pnpm folder.

Expected Behavior

only one of binding-linux-x64-gnu and binding-linux-x64-musl will be installed according to the libc env.

Which Node.js version are you using?

18.17.1

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

No response

Activity

  1. changed the title [-]pnpm install multiple bindings of different bindings[/-] [+]pnpm install multiple bindings of different libc[/+] on Nov 30, 2023
  2. adriaanmeuris commented on Nov 30, 2023

    @adriaanmeuris

    I can confirm this behaviour as we're experiencing the same as described in this issue.

    Our package.json contains the following configuration:

    {
      "name": "sharp-binaries",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {},
      "dependencies": {
        "express": "4.18.2",
        "sharp": "0.33.0"
      },
      "pnpm": {
        "supportedArchitectures": {
          "os": ["linux"],
          "cpu": ["x64"],
          "libc": ["musl"]
        }
      }
    }

    We're building with Docker:

    FROM node:lts-alpine3.18
    WORKDIR /app
    RUN corepack enable && corepack prepare pnpm@latest --activate
    COPY package*.json ./
    RUN pnpm i
    docker build . --no-cache --platform=linux/amd64 --tag 'sharp-binaries:latest'

    After building, we're seeing both linux-x64 and linuxmusl-x64 packages:
    Screenshot 2023-11-30 at 16 36 01

  3. KSXGitHub commented on Dec 4, 2023

    @KSXGitHub
    Contributor

    The documentation doesn't tell much about how this is supposed to work.

    Is this supposed to work with transitive optional dependencies, @zkochan?

  4. nachoaldamav commented on Dec 5, 2023

    @nachoaldamav
    Contributor

    I think the problem is that pnpm is flagging every libc as any, for example

    checkPlatform: registry.npmjs.org/@img/sharp-linux-x64/0.33.0 is installable {
      wantedPlatform: { cpu: [ 'x64' ], os: [ 'linux' ], libc: [ 'any' ] },
      current: { os: [ 'linux' ], cpu: [ 'x64' ], libc: [ 'musl' ] }
    }
    

    I'm checking it

  5. self-assigned this
    on Dec 5, 2023
  6. c0m1c5an5 commented on Feb 29, 2024

    @c0m1c5an5

    @nachoaldamav I am having the same issue with @swc/core wich install both @next/swc-linux-x64-gnu and @next/swc-linux-x64-musl. I would like to clarify, this issue is caused by the missing libc field in package metadata provided by npm registry? If so, the issue will not be fixed until the npm registry starts filling this value?

  7. nachoaldamav commented on Feb 29, 2024

    @nachoaldamav
    Contributor

    @c0m1c5an5 Yes, but there is an option to fix it in pnpm itself, but we would need to fetch the whole manifests in order to make it work. Right now pnpm fetches the simplified manifests that includes the os and cpu but not the libc.

  8. KSXGitHub commented on Sep 25, 2024

    @KSXGitHub
  9. added a commit that references this issue on Sep 28, 2024
    83681da
  10. added a commit that references this issue on Oct 2, 2024
  11. mrstork commented on Apr 10, 2025

    @mrstork

    This seems to have popped up again, I'm using 10.8.0 and the same reproduction steps above work for me. I've also tried a couple of 9.15.x versions and have been able to reproduce there as well.

    I traced through some of the pnpm code and it seems as though the PackageManifest object returned from the npm registry is not including the libc field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions