Yarn: Yarn insiste pour installer des dépendances optionnelles spécifiques à la plate-forme

Créé le 12 janv. 2017  ·  3Commentaires  ·  Source: yarnpkg/yarn

Vous souhaitez demander une fonctionnalité ou signaler un bug ?

Un bug.

Quel est le comportement actuel ?

J'essaie d'ajouter le module etcher-image-write , qui contient une dépendance facultative spécifique à Windows :

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

Le module diskpart déclare dans son package.json qui ne peut être installé que sous Windows :

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

Cependant, j'obtiens le résultat suivant en essayant d'ajouter 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.

Si le comportement actuel est un bogue, veuillez fournir les étapes à reproduire.

yarn add etcher-image-write

Quel est le comportement attendu ?

Étant donné que diskpart est une dépendance facultative de etcher-image-write , Yarn ne doit pas générer d'erreur s'il y a une incompatibilité de plate-forme, et simplement l'omettre, comme npm.

Veuillez mentionner votre node.js, le fil et la version du système d'exploitation.

  • NodeJS : v6.1.0
  • Fil : v0.19.0
  • Système d'exploitation : macOS Sierra 10.12.2
cat-bug

Tous les 3 commentaires

Hum, attends. Cela ne se produit que lorsque j'exécute yarn add etcher-image-write partir de https://github.com/resin-io/etcher , sinon il s'installe très bien, ce qui est étrange.

D'accord, je vais réécrire la description du problème ici, afin que le message d'origine ne se perde pas :

Nous sommes impatients de passer à Yarn pour https://github.com/resin-io/etcher. Voici ce que j'obtiens si je clone le référentiel et que je lance yarn install dessus :

$ 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.

Au départ, je pensais que le problème était lié à etcher-image-write , car faire yarn add etcher-image-write sur etcher/ donne les mêmes résultats, mais le problème semble venir de removedrive .

Ce module est une dépendance facultative d'Etcher lui-même :

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

Et c'est un package Windows uniquement :

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

Le même argument de la question d'origine tient:

Étant donné que removedrive est une dépendance facultative de etcher , Yarn ne doit pas générer d'erreur s'il y a une incompatibilité de plate-forme, et simplement l'omettre, comme npm.

J'ai également ce problème, avec les éléments suivants :
https://github.com/alykoshin/winston-winlog3
dépend d'un module Windows uniquement :
https://github.com/alykoshin/node-windows

nous avons ce qui suit dans notre package.json

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

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

Cette page vous a été utile?
0 / 5 - 0 notes