npm Community Forum (Archive)

The npm community forum has been discontinued.

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

`npm ci` ignores the `os` field of package.json

Steps to reproduce:

echo '{"dependencies": {"default-gateway": "3.1.0"}}' > package.json
npm install --package-lock --package-lock-only
npm ci

default-gateway@3.1.0 has a optional dependency on idb-connector which only supports the AIX platform, so should not be attempted to be installed on other platforms, but npm ci still does.

npm install does not show this behaviour and correctly handles os on dependencies as seen by these warning messages:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: idb-connector@1.1.8 (node_modules\idb-connector):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for idb-connector@1.1.8: wanted {"os":"aix","arch":"any"} (current: {"os":"win32","

Related issue:

npm install --force also reproduces the same behaviour as npm ci