Yarn: Benang bersikeras untuk menginstal dependensi opsional khusus platform

Dibuat pada 12 Jan 2017  ·  3Komentar  ·  Sumber: yarnpkg/yarn

Apakah Anda ingin meminta fitur atau melaporkan bug ?

Sebuah bug.

Apa perilaku saat ini?

Saya mencoba menambahkan modul etcher-image-write , yang berisi ketergantungan opsional khusus Windows:

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

Modul diskpart mendeklarasikan dalam package.json yang hanya dapat diinstal pada Windows:

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

Namun saya mendapatkan output berikut ketika mencoba menambahkan 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 [email protected]: this package is no longer updated or maintained
warning [email protected]: 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 > [email protected]: this package is no longer updated or maintained
warning electron-builder > progress-stream > through2 > xtend > [email protected]:
warning electron-packager > asar > mksnapshot > request > [email protected]: use uuid module instead
[2/4] 🚚  Fetching packages...
warning [email protected]: The platform "darwin" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
warning [email protected]: The platform "darwin" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
error [email protected]: 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.

Jika perilaku saat ini adalah bug, berikan langkah-langkah untuk mereproduksi.

yarn add etcher-image-write

Apa perilaku yang diharapkan?

Karena diskpart adalah dependensi opsional dari etcher-image-write , Benang tidak boleh membuat kesalahan jika ada ketidakcocokan platform, dan cukup abaikan saja, seperti npm.

Sebutkan versi node.js, benang, dan sistem operasi Anda.

  • NodeJS: v6.1.0
  • Benang: v0.19.0
  • OS: macOS Sierra 10.12.2
cat-bug

Semua 3 komentar

Hm, tunggu. Ini hanya terjadi ketika saya menjalankan yarn add etcher-image-write dari https://github.com/resin-io/etcher , jika tidak, ia menginstal dengan baik, yang aneh.

Oke, saya akan menulis ulang deskripsi masalah di sini, agar pesan aslinya tidak hilang:

Kami menantikan untuk pindah ke Benang untuk https://github.com/resin-io/etcher. Inilah yang saya dapatkan jika saya mengkloning repo dan menjalankan yarn install di atasnya:

$ 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 [email protected]: this package is no longer updated or maintained
warning [email protected]: 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 > [email protected]: this package is no longer updated or maintained
warning etcher-image-write > progress-stream > through2 > xtend > [email protected]:
warning electron-packager > asar > mksnapshot > request > [email protected]: use uuid module instead
[2/4] 🚚  Fetching packages...
warning [email protected]: The platform "darwin" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
warning [email protected]: The platform "darwin" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
error [email protected]: 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.

Awalnya saya mengira masalah itu terkait dengan etcher-image-write , karena melakukan yarn add etcher-image-write pada etcher/ menghasilkan hasil yang sama, tetapi masalahnya tampaknya berasal dari removedrive .

Modul ini merupakan dependensi opsional dari Etcher itu sendiri:

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

Dan ini hanya paket Windows:

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

Argumen yang sama dari masalah asli berlaku:

Karena removedrive adalah dependensi opsional dari etcher , Benang tidak boleh membuat kesalahan jika ada ketidakcocokan platform, dan cukup abaikan saja, seperti npm.

Saya juga mengalami masalah ini, dengan yang berikut:
https://github.com/alykoshin/winston-winlog3
tergantung pada modul khusus windows:
https://github.com/alykoshin/node-windows

kami memiliki yang berikut di package.json kami:

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

kesalahan:
error [email protected]: The platform "darwin" is incompatible with this module.

Apakah halaman ini membantu?
0 / 5 - 0 peringkat