微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为什么 yarn force 使用最新的依赖?

如何解决为什么 yarn force 使用最新的依赖?

因为依赖 rollup-plugin-vue@2.5.1 有另一个依赖:vue-template-compiler ">=2.0"

rollup-plugin-vue@2.5.1:
  version "2.5.1"
  ...
      vue-template-compiler ">=2.0"

甚至我在 package.json 中写了 vue-template-compiler@2.5.6

"vue-template-compiler": "2.5.16"

但是最终版本是vue-template-compiler@2.6.12,你会在yarn.lock中看到这样的:

vue-template-compiler@2.5.16:
  version "2.5.16"
  resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.5.16.tgz#93b48570e56c720cdf3f051cc15287c26fbd04cb"
  integrity sha512-ZbuhCcF/hTYmldoUOVcu2fcbeSAZnfzwDskGduOrnjBiIWHgELAd+R8nAtX80aZkceWDKGQ6N9/0/EUpt+l22A==
  dependencies:
    de-indent "^1.0.2"
    he "^1.1.0"

vue-template-compiler@>=2.0:
  version "2.6.12"
  resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.12.tgz#947ed7196744c8a5285ebe1233fe960437fcc57e"
  integrity sha512-OzzZ52zS41YUbkCBfdXShQTe69j1gQDZ9HIX8miuC9C3rBCk9wIRjLiZZLrmX9V+Ftq/YEyv1JaVr5Y/hNtByg==
  dependencies:
    de-indent "^1.0.2"
    he "^1.1.0"

我不想要 2.6.12 出于任何原因,我只需要 2.5.6 。我尝试 npm install,npm 会做正确的事情。为什么yarn使用错误的依赖版本?以及如何修复它?

谢谢!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。