Open MondoGao opened 1 year ago
Related issue in yarn 1: https://github.com/yarnpkg/yarn/issues/5951
Access
Access
This isn't really a bug, so it probably be in the npm/rfcs repo, but it also feels like an oversight. We should probably do this.
I just hit this as well with a monorepo that contains OS and architecture specific packages. As a user of npm, it definitely feels like a bug and renders the workspace feature unusable for such monorepos.
Just encountered the same issue as well and it really does make the workspace rather unusable. It also feels quite hacky having to use --force
to bypass this error.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
When workspace config contains a package that requests an specific os/cpu, if current platform doesn't match that requirement, npm will panic and throw 'EBADPLATFORM' error.
Currently we can't mark a workspace package "optional" in any ways. In order to finish the installation process, we need to use "--force" flag.
Packages that need to build sub n-api platform-specific packages like esbuild face this issue.
Expected Behavior
Let npm have a config to consider a workspace package "optional".
One method to archive that is using optionalDependencies config:
Or add another config like the peerDependenciesMeta:
Steps To Reproduce
For example:
When trying to run npm install on an different platform, error like below will be thrown:
Environment
unrelated