How to resolve Bower dependency version conflicts?

前端 未结 2 1947
太阳男子
太阳男子 2020-12-05 04:02

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

相关标签:
2条回答
  • 2020-12-05 04:24

    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.

    0 讨论(0)
  • 2020-12-05 04:25

    use --force-latest

    enter link description here

    0 讨论(0)
提交回复
热议问题