yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Yarn reports "incorrect peer dependency" for devDependencies of referenced dependencies

Open keithbloom opened this issue 9 years ago • 2 comments

Do you want to request a feature or report a bug?

Bug

What is the current behavior? When I install a dependency which has a devDependency on already installed package but the versions do not match, the install process reports "Incorrect peer dependency" for that package. This came about when upgrading to webpack 2.

If the current behavior is a bug, please provide the steps to reproduce.

mkdir yarn-test
cd yarn-test
yarn init -y
yarn add --dev [email protected]
yarn add --dev [email protected]
yarn add v0.18.1
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning Incorrect peer dependency "webpack@^2.1.0-beta.19".

Looking at the yarn.lock file the extract-text-webpack-plugin entry does not reference webpack

[email protected]:
  version "2.0.0-beta.4"
  resolved "https://registry.yarnpkg.com/extract-text-webpack-plugin/-/extract-text-webpack-plugin-2.0.0-beta.4.tgz#d32393069e7d90c8318d48392302618b56bc1ba9"
  dependencies:
    async "^1.5.0"
    loader-utils "^0.2.3"
    webpack-sources "^0.1.0"

but digging into package.json for the extract-text-webpack-plugin it has a devDependency on an older version of webpack.

  "devDependencies": {
    "codecov.io": "^0.1.2",
    "coveralls": "^2.11.2",
    "css-loader": "^0.21.0",
    "file-loader": "^0.8.4",
    "istanbul": "^0.3.13",
    "mocha": "^2.3.3",
    "mocha-lcov-reporter": "0.0.2",
    "raw-loader": "^0.5.1",
    "should": "^7.1.1",
    "style-loader": "^0.13.0",
    "webpack": "^2.1.0-beta"
  }

What is the expected behavior? I would have thought that yarn would ignore the devDependencies of referenced packages or add them to the yarn.lock file so they can be loaded. If not, how can I fix the error messages?

Please mention your node.js, yarn and operating system version. Node.js v6.9.1 Yarn 0.18.1 Windows 10

keithbloom avatar Jan 04 '17 15:01 keithbloom

Same thing happening here.

  • node v7.3.0 ( homebrew )
  • yarn 0.18.1 ( homebrew)
  • macOS 10.12.2 ( apple :P )

yarn.lock.zip package.json.zip

infernalsirius avatar Jan 12 '17 07:01 infernalsirius

@keithbloom Is that a typo? "yarn add v0.18.1" I get "error Couldn't find package "v0.18.1" on the npm registry"

johnpankowicz avatar May 27 '18 12:05 johnpankowicz