Yarn: Yarn настаивает на установке дополнительных зависимостей для конкретной платформы.

Созданный на 12 янв. 2017  ·  3Комментарии  ·  Источник: yarnpkg/yarn

Вы хотите запросить функцию или сообщить об ошибке ?

Жук.

Каково текущее поведение?

Я пытаюсь добавить модуль etcher-image-write , который содержит дополнительную зависимость для Windows:

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

Модуль diskpart объявляет в своем package.json который может быть установлен только в Windows:

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

Однако при попытке добавить 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.

Если текущее поведение является ошибкой, укажите шаги для воспроизведения.

yarn add etcher-image-write

Какое ожидаемое поведение?

Поскольку diskpart является необязательной зависимостью etcher-image-write , Yarn не должен выдавать ошибку, если есть несоответствие платформы, и просто опускать ее, как npm.

Пожалуйста, укажите ваш node.js, yarn и версию операционной системы.

  • NodeJS: v6.1.0
  • Пряжа: v0.19.0
  • ОС: macOS Sierra 10.12.2

Все 3 Комментарий

Хм, подожди. Это происходит только тогда, когда я запускаю yarn add etcher-image-write с https://github.com/resin-io/etcher , иначе он устанавливается нормально, что странно.

Хорошо, я перепишу здесь описание проблемы, чтобы исходное сообщение не потерялось:

Мы с нетерпением ждем возможности перейти на Yarn для https://github.com/resin-io/etcher. Вот что я получу, если клонирую репо и запускаю на нем yarn install :

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

Первоначально я думал, что проблема была связана с etcher-image-write , поскольку выполнение yarn add etcher-image-write на etcher/ дает те же результаты, но проблема, похоже, исходит из removedrive .

Этот модуль является необязательной зависимостью самого Etcher:

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

И это только пакет Windows:

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

Верен тот же аргумент из исходного выпуска:

Поскольку removedrive является необязательной зависимостью etcher , Yarn не должен выдавать ошибку, если есть несоответствие платформы, и просто опускать ее, как npm.

У меня тоже есть эта проблема со следующим:
https://github.com/alykoshin/winston-winlog3
зависит от модуля только для Windows:
https://github.com/alykoshin/node-windows

в нашем package.json есть следующее

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

ошибка:
error [email protected]: The platform "darwin" is incompatible with this module.

Была ли эта страница полезной?
0 / 5 - 0 рейтинги