Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
keithbloom opened this issue Jan 4, 2017 · 2 comments · Fixed by #4478
Closed
Assignees
Labels

Comments

@keithbloom
Copy link

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 webpack@2.2.0-rc.3
yarn add --dev extract-text-webpack-plugin@2.0.0-beta.4
yarn add v0.18.1
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents@1.0.15: The platform "win32" is incompatible with this module.
info "fsevents@1.0.15" 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

extract-text-webpack-plugin@2.0.0-beta.4:
  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

@infernalsirius
Copy link

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

@BYK BYK self-assigned this Sep 15, 2017
@BYK BYK closed this as completed in #4478 Sep 16, 2017
BYK added a commit that referenced this issue Sep 16, 2017
…4478)

**Summary**

Fixes #4446, fixes #4433, fixes #2688, fixes #2387. Follow up to #3803. The fix in #3893 was
too aggressive, allowing only top-level dependencies to be used in
peer dependency resolution which was incorrect. This patch allows
resolving peer dependencies from the same or higher levels in the
dependency tree.

**Test plan**

Additional unit and integration tests.
joaolucasl pushed a commit to joaolucasl/yarn that referenced this issue Oct 27, 2017
…arnpkg#4478)

**Summary**

Fixes yarnpkg#4446, fixes yarnpkg#4433, fixes yarnpkg#2688, fixes yarnpkg#2387. Follow up to yarnpkg#3803. The fix in yarnpkg#3893 was
too aggressive, allowing only top-level dependencies to be used in
peer dependency resolution which was incorrect. This patch allows
resolving peer dependencies from the same or higher levels in the
dependency tree.

**Test plan**

Additional unit and integration tests.
@johnpankowicz
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants