-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
At Netlify, we publish a module that relies on a platform-specific binary.
In order to only install the appropriate binary for the user's machine, we publish several platform-specific modules, with package.json
appropriately tagged with the right cpu
and os
properties. The main module lists all the platform-specific modules as optionalDependencies
, so that when installed, any platform-specific module that doesn't apply to the user's machine will be skipped, leaving them only with the right module installed in the end.
This behaviour broke with npm v7.
Current Behavior:
When installing @netlify/traffic-mesh-agent
, all the optional dependencies are installed, regardless of whether they apply to the user's platform.
Expected Behavior:
When installing @netlify/traffic-mesh-agent
, only the optional dependencies that apply to the user's platform are actually installed. The others are skipped at the installation process.
Steps To Reproduce:
- Run
npm install @netlify/traffic-mesh-agent
- Verify that 3 platform-specific modules are present inside
node_modules
:@netlify/traffic-mesh-agent-darwin-x64
,@netlify/traffic-mesh-agent-win32-x64
and@netlify/traffic-mesh-agent-linux-x64
Environment:
- OS: macOS Big Sur 11.2
- Node: 15.8.0
- npm: 7.5.0