运行bower install命令时无法找到合适的角度版本

时间:2017-04-06 08:27:05

标签: angularjs bower-install

运行bower install命令时收到以下消息。

enter image description here

enter image description here

bower.json:

{
  "name": "test-app",
  "version": "1.1.6",
  "dependencies": {
               "jquery": "2.1.0",
               "jquery-bridget": "*",
    "angular": "1.3.15",
    "json3": "~3.2.6",
    "es5-shim": "~2.1.0",
    "angular-resource": "1.3.15",
    "angular-sanitize": "1.3.15",
    "angular-animate": "1.3.15",
    "angular-cookies": "1.3.15",
    "angular-touch": "1.3.15",
    "angular-moment": "~0.6.2",
    "angular-loading-bar": "0.6.0",
    "angular-masonry": "0.11.0",
    "js-cookie": "2.1.3"
  },
  "devDependencies": {
    "angular-mocks": "1.3.15",
    "angular-scenario": "1.3.15"
  }
}

任何人都可以帮我这里如何继续前进。

谢谢, 桑托什

3 个答案:

答案 0 :(得分:2)

这是因为您注入的依赖项需要不同版本的angularJs。要解决它,首先找到一个合适的angularJs兼容版本。然后,您可以将resolutions添加到bower.json文件中的对象,并指定组件名称&版本在运行bower命令时自动解决冲突。像这样:

{
 "name": "test-app",
 "version": "1.1.6",
 "dependencies": {
           "jquery": "2.1.0",
           "jquery-bridget": "*",
     "angular": "1.3.15",
     "json3": "~3.2.6",
     "es5-shim": "~2.1.0",
     "angular-resource": "1.3.15",
     "angular-sanitize": "1.3.15",
     "angular-animate": "1.3.15",
     "angular-cookies": "1.3.15",
     "angular-touch": "1.3.15",
     "angular-moment": "~0.6.2",
     "angular-loading-bar": "0.6.0",
     "angular-masonry": "0.11.0",
     "js-cookie": "2.1.3"
  },
  "devDependencies": {
     "angular-mocks": "1.3.15",
     "angular-scenario": "1.3.15"
  },
  "resolutions": {
     "angular": "1.3.15"
  }
}

答案 1 :(得分:0)

尝试升级到angular-moment

等最近的~0.10版本

答案 2 :(得分:0)

您可以使用bower属性明确告诉resolutions安装特定版本的依赖项。像这样:

"dependencies": {
    "jquery": "2.1.0",
    "jquery-bridget": "*",
    ...
}, 
"resolutions": {
    "angular": "1.4.8",
    ...
}