1

When ever I run yarn global add ... or yarn global remove ... it gives warnings such as ...

warning "nativescript > marked-terminal@3.1.1" has incorrect peer dependency "marked@^0.4.0 || ^0.5.0".
warning "nativescript > nativescript-preview-sdk > tslint@5.4.3" has unmet peer dependency "typescript@>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev".
warning "nativescript > nativescript-preview-sdk > tslint > tsutils@2.29.0" has unmet peer dependency "typescript@>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev".

or

yarn add ... and yarn remove ... commands give warnings such as ...

warning " > babel-loader@8.0.6" has unmet peer dependency "webpack@>=2".
warning "nativescript-dev-webpack > ts-loader@5.4.5" has unmet peer dependency "typescript@*".
warning " > vue-loader@15.4.2" has unmet peer dependency "css-loader@*".

How to fix these dependency problems?

NOTE: It seems yarn upgrade and yarn cache clean do not help either

Cem Kaan
  • 2,086
  • 1
  • 24
  • 55

1 Answers1

2

yarn (but it would be the same if you used npm as a client) is warning you about unmet peer dependencies. Peer dependencies are different from your usual dependencies in that installing a module will not install its peer dependencies, with the implicit assumption that you already have them, or will need them anyway to use that package.

For example, babel-loader clearly needs Webpack to be used, and instead of bringing it in as a transitive dependency, it expects you to have it in your package.json.

There are a couple of situations where this does not work as expected:

  • a package expects a peer dependency with a version, but you have a version number that is incompatible (it might still work though)
  • a package might list a peer dependency which you really don't need - for example eslint-config-react-app requires a peer of eslint-plugin-flowtype, which is pointless if you are not using Flow.

How to fix this? by adding those dependencies to your project.

Agos
  • 18,542
  • 11
  • 56
  • 70