Você quer solicitar um recurso ou relatar um bug ?
Um inseto.
Qual é o comportamento atual?
Estou tentando adicionar o módulo etcher-image-write
, que contém uma dependência opcional específica do Windows:
...
"optionalDependencies": {
"diskpart": "^1.0.0"
},
...
O módulo diskpart
declara em seu package.json
que só pode ser instalado no Windows:
..
"os": [
"win32"
],
..
No entanto, obtenho o seguinte resultado quando tento adicionar 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.
Se o comportamento atual for um bug, forneça as etapas para reproduzi-lo.
yarn add etcher-image-write
Qual é o comportamento esperado?
Como diskpart
é uma dependência opcional de etcher-image-write
, o Yarn não deve gerar um erro se houver uma incompatibilidade de plataforma e simplesmente omiti-lo, como npm.
Mencione seu node.js, yarn e versão do sistema operacional.
Hm, espere. Isso só acontece quando executo yarn add etcher-image-write
em https://github.com/resin-io/etcher , caso contrário, ele instala perfeitamente, o que é estranho.
Ok, vou reescrever a descrição do problema aqui, para que a mensagem original não se perca:
Estamos ansiosos para mudar para o Yarn em https://github.com/resin-io/etcher. Aqui está o que eu ganho se clonar o repo e executar yarn install
nele:
$ 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 pensei que o problema estava relacionado a etcher-image-write
, uma vez que yarn add etcher-image-write
em etcher/
produziu os mesmos resultados, mas o problema parece vir de removedrive
.
Este módulo é uma dependência opcional do próprio Etcher:
...
"optionalDependencies": {
"elevator": "^2.1.0",
"removedrive": "^1.1.1"
},
..
E é um pacote somente para Windows:
...
"os": [
"win32"
],
...
O mesmo argumento da questão original é válido:
Como removedrive
é uma dependência opcional de etcher
, o Yarn não deve gerar um erro se houver uma incompatibilidade de plataforma e simplesmente omiti-lo, como npm.
Também estou tendo esse problema com o seguinte:
https://github.com/alykoshin/winston-winlog3
depende de um módulo somente para Windows:
https://github.com/alykoshin/node-windows
temos o seguinte em nosso package.json
"optionalDependencies": {
"winston-winlog3": "^1.0.6"
},
erro:
error [email protected]: The platform "darwin" is incompatible with this module.