Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] cpu and os properties not respected #2707

Closed
eduardoboucas opened this issue Feb 16, 2021 · 3 comments · Fixed by npm/arborist#231
Closed

[BUG] cpu and os properties not respected #2707

eduardoboucas opened this issue Feb 16, 2021 · 3 comments · Fixed by npm/arborist#231
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 7.x work is associated with a specific npm 7 release

Comments

@eduardoboucas
Copy link

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
@eduardoboucas eduardoboucas added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Feb 16, 2021
@ljharb
Copy link
Contributor

ljharb commented Feb 16, 2021

I’ve never known “cpu” or “os” properties to matter - i see them here, but can you link to the docs that indicate these are supported properties in package.json?

@eduardoboucas
Copy link
Author

I’ve never known “cpu” or “os” properties to matter - i see them here, but can you link to the docs that indicate these are supported properties in package.json?

Sure: cpu and os.

@ljharb
Copy link
Contributor

ljharb commented Feb 16, 2021

TIL, thank you :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants