Roby Cigar
Roby Cigar

Reputation: 938

Install all unmet dependencies in yarn

There's error in my react app, it says:

    Line 0:  Parsing error: Cannot find module 'eslint-scope' from '/home/path/.cache/yarn/v6/npm-eslint-7.11.0-aaf2d23a0b5f1d652a08edacea0c19f7fadc0b3b-integrity/node_modules/eslint/lib/api.js'

Then I add eslint-scope to my dependencies with the following command:

    yarn add eslint-scope

But I found so much, unmet peer dependencies:

    warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=7.21.4".
    warning " > [email protected]" has unmet peer dependency "@typescript-eslint/eslint-plugin@^4.0.0".
    warning " > [email protected]" has unmet peer dependency "@typescript-eslint/parser@^4.0.0".
    warning " > [email protected]" has unmet peer dependency "babel-eslint@^10.0.0".
    warning " > [email protected]" has unmet peer dependency "eslint-plugin-flowtype@^5.2.0".
    warning " > [email protected]" has unmet peer dependency "eslint-plugin-import@^2.22.0".
    warning " > [email protected]" has unmet peer dependency "eslint-plugin-jsx-a11y@^6.3.1".
    warning " > [email protected]" has unmet peer dependency "eslint-plugin-react@^7.20.3".
    warning " > [email protected]" has unmet peer dependency "eslint-plugin-react-hooks@^4.0.8".

When I tried install one of those, I found another unmet dependencies:

    warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=7.21.4".
    warning " > [email protected]" has unmet peer dependency "@typescript-eslint/eslint-plugin@^4.0.0".
    warning " > [email protected]" has unmet peer dependency "@typescript-eslint/parser@^4.0.0".
    warning " > [email protected]" has unmet peer dependency "eslint-plugin-flowtype@^5.2.0".
    warning " > [email protected]" has unmet peer dependency "eslint-plugin-import@^2.22.0".
    warning " > [email protected]" has unmet peer dependency "eslint-plugin-jsx-a11y@^6.3.1".
    warning " > [email protected]" has unmet peer dependency "eslint-plugin-react@^7.20.3".
    warning " > [email protected]" has unmet peer dependency "eslint-plugin-react-hooks@^4.0.8".

can I install all of the unmeet dependencies automatically?

Upvotes: 7

Views: 9987

Answers (2)

dsaydon
dsaydon

Reputation: 4769

Another way to solve this is by using the check-peer-dependencies npm package (link)

example:

yarn install --no-progress --non-interactive \
&& npx check-peer-dependencies --yarn --install \

In case that your are experience some issues like "Unable to find a version", you can do something like that:

yarn install --no-progress --non-interactive \
(npx check-peer-dependencies --yarn --install || true)

note: check-peer-dependencies (version: 4.2.0) will install the peer dependency, but from some reason it will throw an error.

Upvotes: 1

Nikhil Verma
Nikhil Verma

Reputation: 39

First of all you should try to find out why eslint-scope is needed by running this command yarn why eslint-scope.

If you still think it's needed then you should know that peer dependencies by default are not installed anymore. You can read more about it here. In NPM V7 peerDependencies are installed automatically again.

For now you should try using the install-peerdeps package npx install-peerdeps -Y eslint-scope

Upvotes: 0

Related Questions