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

Yarn insists on installing platform specific optional dependencies #2437

Closed
jviotti opened this issue Jan 12, 2017 · 4 comments
Closed

Yarn insists on installing platform specific optional dependencies #2437

jviotti opened this issue Jan 12, 2017 · 4 comments
Labels

Comments

@jviotti
Copy link

jviotti commented Jan 12, 2017

Do you want to request a feature or report a bug?

A bug.

What is the current behavior?

I'm trying to add the etcher-image-write module, which contains a Windows specific optional dependency:

  ...
  "optionalDependencies": {
    "diskpart": "^1.0.0"
  },
  ...

The diskpart module declares in its package.json that can only be installed on Windows:

  ..
  "os": [
    "win32"
  ],
  ..

However I get the following output when trying to add etcher-image-write:

$ yarn add etcher-image-write
yarn add v0.19.0
info No lockfile found.
warning npm-shrinkwrap.json found. This will not be updated or respected. See https://yarnpkg.com/en/docs/migrating-from-npm for more information.
[1/4] 🔍  Resolving packages...
warning file-tail@0.3.0: this package is no longer updated or maintained
warning electron-prebuilt@1.4.4: electron-prebuilt has been renamed to electron. For more details, see http://electron.atom.io/blog/2016/08/16/npm-install-electron
warning file-tail > file-size-watcher@0.2.1: this package is no longer updated or maintained
warning electron-builder > progress-stream > through2 > xtend > object-keys@0.4.0:
warning electron-packager > asar > mksnapshot > request > node-uuid@1.4.7: use uuid module instead
[2/4] 🚚  Fetching packages...
warning elevator@2.1.0: The platform "darwin" is incompatible with this module.
info "elevator@2.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
warning removedrive@1.1.1: The platform "darwin" is incompatible with this module.
info "removedrive@1.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
error diskpart@1.0.1: The platform "darwin" is incompatible with this module.
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

If the current behavior is a bug, please provide the steps to reproduce.

yarn add etcher-image-write

What is the expected behavior?

Since diskpart is an optional dependency of etcher-image-write, Yarn should not throw an error if there is a platform mismatch, and simply omit it, like npm.

Please mention your node.js, yarn and operating system version.

  • NodeJS: v6.1.0
  • Yarn: v0.19.0
  • OS: macOS Sierra 10.12.2
@jviotti
Copy link
Author

jviotti commented Jan 12, 2017

Hm, wait. This is only happens when I run yarn add etcher-image-write from https://github.com/resin-io/etcher, otherwise it installs just fine, which is weird.

@jviotti
Copy link
Author

jviotti commented Jan 12, 2017

Okay, I'll rewrite the issue description here, so the original message doesn't get lost:

We're looking forward to move to Yarn for https://github.com/resin-io/etcher. Here's what I get if I clone the repo and run yarn install on it:

$ git clone https://github.com/resin-io/etcher
$ yarn install
yarn install v0.19.0
info No lockfile found.
warning npm-shrinkwrap.json found. This will not be updated or respected. See https://yarnpkg.com/en/docs/migrating-from-npm for more information.
[1/4] 🔍  Resolving packages...
warning file-tail@0.3.0: this package is no longer updated or maintained
warning electron-prebuilt@1.4.4: electron-prebuilt has been renamed to electron. For more details, see http://electron.atom.io/blog/2016/08/16/npm-install-electron
warning file-tail > file-size-watcher@0.2.1: this package is no longer updated or maintained
warning etcher-image-write > progress-stream > through2 > xtend > object-keys@0.4.0:
warning electron-packager > asar > mksnapshot > request > node-uuid@1.4.7: use uuid module instead
[2/4] 🚚  Fetching packages...
warning removedrive@1.1.1: The platform "darwin" is incompatible with this module.
info "removedrive@1.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
warning elevator@2.1.0: The platform "darwin" is incompatible with this module.
info "elevator@2.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
error diskpart@1.0.1: The platform "darwin" is incompatible with this module.
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

I originally though the issue was related to etcher-image-write, since doing yarn add etcher-image-write on etcher/ yield the same results, but the issue seems to come from removedrive.

This module is an optional dependency of Etcher itself:

  ...
  "optionalDependencies": {
    "elevator": "^2.1.0",
    "removedrive": "^1.1.1"
  },
  ..

And its a Windows only package:

  ...
  "os": [
    "win32"
  ],
  ...

The same argument from the original issue holds:

Since removedrive is an optional dependency of etcher, Yarn should not throw an error if there is a platform mismatch, and simply omit it, like npm.

@BenjaminVerble
Copy link

I'm having this issue as well, with the following:
https://github.com/alykoshin/winston-winlog3
depends on a windows-only module:
https://github.com/alykoshin/node-windows

we have the following in our package.json

  "optionalDependencies": {
    "winston-winlog3": "^1.0.6"
  },

error:
error node-windows2@0.0.3: The platform "darwin" is incompatible with this module.

@jviotti
Copy link
Author

jviotti commented Aug 15, 2022

Closing stale issues

@jviotti jviotti closed this as completed Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants