Skip to content

[BUG] npm ci ignores the os field of package.json #658

@guidobouman

Description

@guidobouman

What / Why

Executing npm ci ignores the os field in package.json. This causes platform specific packages like fsevents (macOS-only) to be installed on other platforms (Windows in this case).

When

  • Every install through npm ci

Where

  • Packages with the os field specified in package.json

How

Current Behavior

  • See description

Steps to Reproduce

  1. Run npm init in a new directory on a windows machine
  2. Install a package with a deeply nested optional dependency on fsevents, like webpack: npm i webpack
  3. Notice a package-lock.json is created with an optional dependency on [email protected]
  4. Remove node_modules te create a clean CI clone state
  5. Run npm ci
  6. See the installation fail because fsevents is downloaded, installed, and node-gyp is executed as a result.

Expected Behavior

  • fsevents is skipped as the package is unsupported on Windows.

Who

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions