yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.72k forks source link

yarn check fails with valid yarn.lock and node_modules #7369

Open skovy opened 5 years ago

skovy commented 5 years ago

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

Report a bug.

What is the current behavior?

After a fresh install (with specific package versions) yarn check fails with the error: "acorn" is wrong version: expected "2.7.0", got "6.1.1".

The issue appears to be that this specific version of jsdom@7.2.2 expects acorn@^2.4.0 but webpack@4.33.0 expects acorn@^6.0.5 and webpack-bundle-analyzer@3.3.2 expects ^6.0.7.

package.json

{
  "dependencies": {
    "jsdom": "7.2.2",
    "webpack": "4.33.0",
    "webpack-bundle-analyzer": "3.3.2"
  }
}

snippet of relevant yarn.lock

acorn@^2.1.0, acorn@^2.4.0:
  version "2.7.0"
  resolved "https://registry.yarnpkg.com/acorn/-/acorn-2.7.0.tgz#ab6e7d9d886aaca8b085bc3312b79a198433f0e7"
  integrity sha1-q259nYhqrKiwhbwzEreaGYQz8Oc=

acorn@^6.0.5, acorn@^6.0.7:
  version "6.1.1"
  resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f"
  integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==

snippet of installed packages in node_modules

> cat node_modules/webpack/package.json | grep version
  "version": "4.33.0",
> cat node_modules/webpack-bundle-analyzer/package.json | grep version
  "version": "3.3.2",
> cat node_modules/acorn/package.json | grep version
  "version": "6.1.1",
> cat node_modules/jsdom/package.json | grep version
  "version": "7.2.2",
> cat node_modules/jsdom/node_modules/acorn/package.json | grep version
  "version": "2.7.0",

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

Steps

> yarn init
> yarn add jsdom@7.2.2 webpack@4.33.0 webpack-bundle-analyzer@3.3.2
> yarn check
yarn check v1.16.0
error "acorn" is wrong version: expected "2.7.0", got "6.1.1"
error "webpack#acorn" not installed
error "webpack-bundle-analyzer#acorn" not installed
error "webpack#acorn-dynamic-import" not installed
warning "chokidar#fsevents#node-pre-gyp@^0.12.0" could be deduped from "0.12.0" to "node-pre-gyp@0.12.0"
error Found 4 errors.
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.

What is the expected behavior?

yarn check passes with no errors since both versions of acorn is installed to satisfy package dependencies.

Please mention your node.js, yarn and operating system version.

yarn version: 1.16.0
node version: 10.8.0
OS: macOS 10.13.6
stereoscott commented 5 years ago

Found this issue when searching for:

warning "chokidar#fsevents#node-pre-gyp@^0.12.0" could be deduped from "0.12.0" to "node-pre-gyp@0.12.0"

I can't get that warning to go away despite having having only version of node-pre-gyp in my yarn.lock.

STRML commented 4 years ago

Seeing the same out of the box on https://github.com/STRML/react-resizable/tree/v1.10.1.