FG
šŸ’» SoftwarešŸ› ļø Developer ToolsMicrosoft

[BUG] npm ci installs an optional dependency which targets a different os than the host os

Freshalmost 5 years ago
Mar 14, 20260 views
Confidence Score78%
78%

Problem

What / Why npm ci seems to install an optional dependency for the linux os when running on a mac and seems to install the optional dependency for mac when running on linux. When [code block] <details> <summary>click to view output of above command</summary> <pre> Wrote to /private/tmp/d/package.json: { "name": "d", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC" } > oax@0.5.25 postinstall /private/tmp/d/node_modules/oax > node ./postinstall.js npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN d@1.0.0 No description npm WARN d@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: oax-windows-64@0.5.25 (node_modules/oax/node_modules/oax-windows-64): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for oax-windows-64@0.5.25: wanted {"os":"win32","arch":"x64"} (current: {"os":"darwin","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: oax-linux-64@0.5.25 (node_modules/oax/node_modules/oax-linux-64): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for oax-linux-64@0.5.25: wanted {"os":"linux","arch":"x64"} (current: {"os":"darwin","arch":"x64"}) + oax@0.5.25 added 2 packages and audited 4 packages in 1.1s found 0 vulnerabilities d@1.0.0 /private/tmp/d └─┬ oax@0.5.25 ā”œā”€ā”€ oax-darwin@0.5.25 ā”œā”€ā”€ UNMET OPTIONAL DEPENDEN

Error Output

Error: no test specified\" && exit 1"

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
76% confidence100% success rate4 verificationsLast verified Mar 14, 2026

Solution: [BUG] npm ci installs an optional dependency which targets a different os than the host os

Low Risk

I ran into the same problem with fsevents on Windows, when installing two packages that depend on different versions of fsevents. [code block] Latest webpack depends on watchpack which depends on an older chokidar@2.1.8 which depends on an old fsevents@1.2.11. While chokidar latest depends on fsevents@2.1.2 But npm install skipped correctly both versions of fsevents as they are OS-incompatibl

76

Trust Score

4 verifications

100% success
  1. 1

    I ran into the same problem with fsevents on Windows, when installing two packag

    I ran into the same problem with fsevents on Windows, when installing two packages that depend on different versions of fsevents.

  2. 2

    Latest webpack depends on watchpack which depends on an older chokidar@2.1.8 whi

    Latest webpack depends on watchpack which depends on an older chokidar@2.1.8 which depends on an old fsevents@1.2.11.

  3. 3

    While chokidar latest depends on fsevents@2.1.2

    While chokidar latest depends on fsevents@2.1.2

  4. 4

    But npm install skipped correctly both versions of fsevents as they are OS-inco

    But npm install skipped correctly both versions of fsevents as they are OS-incompatible.

Validation

Resolved in npm/cli GitHub issue #558. Community reactions: 7 upvotes.

Verification Summary

Worked: 4
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

npmpackage-managernodejsbug