Skip to content

npm install lefthook error #1080

@jimyhdolores

Description

@jimyhdolores

🔧 Summary

When installing lefthook using npm on Windows, the installation fails due to a platform-specific dependency (@css-inline/css-inline-linux-x64-gnu). This does not happen when using pnpm, which correctly handles platform-specific optional dependencies.

Steps to reproduce

  1. On a Windows machine (OS: win32, CPU: x64)
  2. Initialize a Node project: npm init -y
  3. Run: npm install lefthook

This will fail with the following error:

Unsupported platform for @css-inline/[email protected]: 
wanted {"os":"linux","cpu":"x64"} (current: {"os":"win32","cpu":"x64"})

Expected results

The installation should skip incompatible optional dependencies and complete successfully on Windows, similar to the behavior with pnpm.

Actual results

Installation fails entirely when using npm due to an unsupported platform error.

Possible Solution

  • Either mark the dependency @css-inline/css-inline-linux-x64-gnu as optional or provide platform-specific variants (e.g., @css-inline/css-inline-win32-x64-gnu) depending on the current system.
  • Alternatively, adjust packaging so platform-specific binaries are only resolved during runtime, or provide fallback handling via JS if the native binary is missing.

Logs / Screenshots

$ npm install lefthook

npm error code EBADPLATFORM
npm error notsup Unsupported platform for @css-inline/[email protected]: wanted {"os":"linux","cpu":"x64","libc":"glibc"} (current: {"os":"win32","cpu":"x64"})
npm error notsup Valid os:    linux
npm error notsup Actual os:   win32
npm error notsup Valid cpu:   x64
npm error notsup Actual cpu:  x64
npm error notsup Valid libc:  glibc
npm error notsup Actual libc: undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions