When installing packages with Yarn, what does “incorrect peer dependency” mean?

后端 未结 2 923
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 19:15

I\'ve just cloned a repo, which recommends the use of Yarn to install dependencies. When I run yarn install, it seems to be okay, but it provides this warning:<

2条回答
  •  既然无缘
    2020-12-29 19:47

    I think that there are packages for which it doesn't make a big difference (if not exposed in your app or not likely that conflicting versions create problems, e.g. moment.js), but then there are packages, like React, for which it matters that all React dependencies are compatible with each other as they might create components that have to understand each other.

    In your case, probably one of your dependencies uses sass-loader in a different version than you specify in your project.

    By declaring it as a peerDependency you can tell npm which version your project expects and it will give you a warning (as you saw) when there is a conflict.

提交回复
热议问题