Skip to content

[BUG] NPM v7.x does not skip OPTIONAL DEPENDENCY #2739

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

Closed
osdevisnot opened this issue Feb 20, 2021 · 1 comment
Closed

[BUG] NPM v7.x does not skip OPTIONAL DEPENDENCY #2739

osdevisnot opened this issue Feb 20, 2021 · 1 comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release

Comments

@osdevisnot
Copy link

Background:

I am an author of a golang project called sorvor and I wish to distribute golang binaries using NPM so that consumers do not have to install separate toolchain to get sorvor.

To achieve this, I've published prebuilt platform specific native binaries to NPM via below packages:
https://www.npmjs.com/package/sorvor-darwin-64
https://www.npmjs.com/package/sorvor-darwin-arm64
https://www.npmjs.com/package/sorvor-freebsd-64
https://www.npmjs.com/package/sorvor-freebsd-arm64
https://www.npmjs.com/package/sorvor-linux-32
https://www.npmjs.com/package/sorvor-linux-64
https://www.npmjs.com/package/sorvor-linux-arm
https://www.npmjs.com/package/sorvor-linux-arm64
https://www.npmjs.com/package/sorvor-windows-32
https://www.npmjs.com/package/sorvor-windows-64

I am expecting user's to have a single NPM dependency in their package.json for the main package:
https://www.npmjs.com/package/sorvor

The main package lists all the native packages as optional dependencies so that and NPM can install appropriate optional dependency for a given platform.

Current Behavior:

NPM v7.x installs all optional dependencies without checking current OS and CPU arch.

Expected Behavior:

NPM v7.x should install optional dependencies only for current OS and CPU arch.

Note: This works correctly with NPM v6.x

Steps To Reproduce:

run npm install --save-dev sorvor

Environment:

  • OS: Darwin x86_64
  • Node: 15.9.0
  • NPM: 7.5.3

Related Issues:

#558
#475

@osdevisnot osdevisnot 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 20, 2021
@osdevisnot
Copy link
Author

Duplicate of #2707

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

1 participant