Yarn: Yarn insiste en instalar dependencias opcionales específicas de la plataforma

Creado en 12 ene. 2017  ·  3Comentarios  ·  Fuente: yarnpkg/yarn

¿Quieres solicitar una función o informar de un error ?

Un insecto.

¿Cuál es el comportamiento actual?

Estoy tratando de agregar el módulo etcher-image-write , que contiene una dependencia opcional específica de Windows:

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

El módulo diskpart declara en su package.json que solo se puede instalar en Windows:

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

Sin embargo, obtengo el siguiente resultado al intentar agregar 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 el comportamiento actual es un error, proporcione los pasos para reproducirlo.

yarn add etcher-image-write

¿Cuál es el comportamiento esperado?

Dado que diskpart es una dependencia opcional de etcher-image-write , Yarn no debería generar un error si hay una discrepancia de plataforma y simplemente omitirlo, como npm.

Por favor, mencione su versión de node.js, yarn y sistema operativo.

  • NodeJS: v6.1.0
  • Hilado: v0.19.0
  • SO: macOS Sierra 10.12.2
cat-bug

Todos 3 comentarios

Hm, espera. Esto solo sucede cuando ejecuto yarn add etcher-image-write desde https://github.com/resin-io/etcher , de lo contrario, se instala bien, lo cual es extraño.

Bien, volveré a escribir la descripción del problema aquí, para que el mensaje original no se pierda:

Esperamos pasar a Yarn para https://github.com/resin-io/etcher. Esto es lo que obtengo si clono el repositorio y ejecuto yarn install en él:

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

Originalmente pensé que el problema estaba relacionado con etcher-image-write , ya que hacer yarn add etcher-image-write en etcher/ produce los mismos resultados, pero el problema parece provenir de removedrive .

Este módulo es una dependencia opcional del propio Etcher:

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

Y es un paquete exclusivo de Windows:

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

El mismo argumento del problema original es válido:

Dado que removedrive es una dependencia opcional de etcher , Yarn no debería generar un error si hay una discrepancia de plataforma y simplemente omitirlo, como npm.

También tengo este problema, con lo siguiente:
https://github.com/alykoshin/winston-winlog3
depende de un módulo solo para Windows:
https://github.com/alykoshin/node-windows

tenemos lo siguiente en nuestro package.json

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

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

¿Fue útil esta página
0 / 5 - 0 calificaciones