How to resolve Bower dependency version conflicts?

我怕爱的太早我们不能终老 提交于 2019-11-26 19:47:35

问题


I have a project that depends on both:

  • jquery ~1.9.1
  • another project which in turn depends on jquery >=1.7.2

But when I run bower install, it ends up installing jquery 2.0.2. This seems broken.

How do I either (a) make it correctly solve the constraints or (b) explicitly force a final version to be installed (workaround)?


回答1:


You can add resolutions to the object in your bower.json file and specify the component name & version to automatically resolve the conflict when running bower commands. Like this:

{
  "name": "project-x",
  "private": true,
  "dependencies": {
    "bootstrap-sass": "~3.3.7",
    "modernizr": "~2.8.3",
    "jquery": "~1.11.3"
  },
  "devDependencies": {},
  "resolutions": {
    "jquery": "~1.11.3"
  }
}

Also you can run bower install and when bower will ask for "suitable version" (if interactive mode is on), prefix choice with !, so bower will save your choice into bower.json file.




回答2:


use --force-latest

enter link description here



来源:https://stackoverflow.com/questions/16991128/how-to-resolve-bower-dependency-version-conflicts

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!