npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

`npm ci` treats optionalDependency with unsupported platform differently than `npm install`

When you have platform-specific optional dependencies, npm install does ignore to install those dependencies on unsupported platform, with messages like below:

optional SKIPPING OPTIONAL DEPENDENCY: @nodert-win10-au/windows.applicationmodel@0.2.96 (node_modules/@nodert-win10-au/windows.applicationmodel):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @nodert-win10-au/windows.applicationmodel@0.2.96: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"x64"})

But in case of npm ci, it doesn’t honor optional dep’s platform but try to install it and fails instead. What makes this differences when using same package-lock, and is there recommended way to achieve same behavior to npm install? Above has tested against npm cli @6.3.0.

Test repo is created at, job using npm install is , other job does npm ci is which shows described behavior above.