Skip to content

[BUG] cpu and os properties not respected #2707

@eduardoboucas

Description

@eduardoboucas

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:

  1. Run npm install @netlify/traffic-mesh-agent
  2. 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

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions