英文:
What should I do about "warning ... unmet peer dependency" when using yarn?
问题
我使用yarn安装了近1000个JavaScript库。当安装完成后,我运行yarn install --check-files
,它警告我留下了一些库未安装。我觉得很奇怪,它几乎安装了所有库,只是警告没有安装其中的一小部分(但我稍后会阅读为什么yarn会这样做),现在,我需要弄清楚如何处理这些未满足的对等依赖关系?
示例输出
yarn install --check-files
yarn install v1.22.19
[1/4] 🤥 Resolving packages...
[2/4] 🤦♂️ Fetching packages...
[3/4] 🤟 Linking dependencies...
warning "> babel-loader@8.3.0" has unmet peer dependency "@babel/core@^7.0.0".
warning "> babel-plugin-polyfill-corejs2@0.3.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "> babel-plugin-polyfill-corejs3@0.6.0" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "> babel-plugin-polyfill-regenerator@0.4.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "> bootstrap@4.6.2" has unmet peer dependency "popper.js@^1.16.1".
[4/4] 🤖 Building fresh packages...
✨ Done in 1.52s.
我的猜测只是使用以下命令安装它们:
yarn add @popper.js@^1.16.1
yarn add @babel/core@^7.0.0-0
不过我不太确定,希望能弄对(还不确定第一个@
和^
是否应该在那里)。
注意
虽然我已经在上面提到并链接到了它,我再次重申,这个问题不同于*在使用yarn安装包时,“有未满足的对等依赖”是什么意思?*,因为它问的是什么是对等依赖,而我(以及其他90人)想知道的是使用yarn应该采取哪些步骤来确保安装了所有(对等)依赖。
英文:
I used yarn to install almost 1000 js libraries. When it's done I run yarn install --check-files
and it warns me that it left out just a few. I find this bizarre that it installs almost all and only warns about not installing a small handful (but I'll read up on why yarn's doing that later), for now, I need to figure out what to do about these unmet peer dependencies?
Example output
yarn install --check-files
yarn install v1.22.19
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning " > babel-loader@8.3.0" has unmet peer dependency "@babel/core@^7.0.0".
warning " > babel-plugin-polyfill-corejs2@0.3.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > babel-plugin-polyfill-corejs3@0.6.0" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > babel-plugin-polyfill-regenerator@0.4.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > bootstrap@4.6.2" has unmet peer dependency "popper.js@^1.16.1".
[4/4] 🔨 Building fresh packages...
✨ Done in 1.52s.
My guess is simply install them with
yarn add @popper.js@^1.16.1
yarn add @babel/core@^7.0.0-0
I'm not totally sure though and want to get it right (also not sure if the first @
and ^
should be there).
Note
Although I already mentioned it above and link to it, I reiterate, that this question differs from What does 'has unmet peer dependency' mean when installing a package with yarn? in that it asked about what a peer dependency is, whereas I (and 90 others) would like to know what must be done with yarn to ensure all (peer) dependencies are installed.
答案1
得分: 2
如何解决
复制警告消息中未满足的对等依赖的名称,并使用以下方式通过 Yarn 添加它:
yarn add '<未满足的对等依赖>'
不要忘记在依赖周围使用 '
(单引号),如果未满足的对等依赖包含 @
和 ^
符号,请保留它们。
示例
问题中的错误消息是
warning "> babel-plugin-polyfill-corejs2@0.3.3" has unmet peer dependency "@babel/core@^7.0.0-0".
因此,您将运行
yarn add '@babel/core@^7.0.0-0'
来添加它。
重复此步骤,直到在运行 yarn install --check-files
时所有警告都消失,并且输出看起来像这样(不再有警告):
yarn install --check-files
yarn install v1.22.19
[1/4] 🤝 Resolving packages...
[2/4] 🚫 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] ✨ Building fresh packages...
✨ Done in 1.54s.
英文:
How to solve
Copy the name of the unmet peer dependency from the warning message, and add it using yarn like so:
yarn add '<unmet peer dependency>'
don't forget the '
and '
around the dependency, (and keep the @
and ^
symbols if the unmet peer dependency has them).
Example
The error message in the question has
warning " > babel-plugin-polyfill-corejs2@0.3.3" has unmet peer dependency "@babel/core@^7.0.0-0".
so you'd run
yarn add '@babel/core@^7.0.0-0'
to add it.
Repeat this until all the warnings have gone when you run yarn install --check-files
and the output just looks something like this (no warnings any more):
yarn install --check-files
yarn install v1.22.19
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
✨ Done in 1.54s.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论