`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","
arch":"x64"})

Related issue: https://github.com/silverwind/default-gateway/issues/10

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

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.