我在尝试在项目上执行bower安装时遇到问题
我正在我的debian OS上执行 bower install 命令 但是当这是识别我的bower.json上定义的依赖关系。
它陷入了我不理解的部分
这是我在命令行中看到的最后一部分
"dependencies": {
"angular": {
"endpoint": {
"name": "angular",
"source": "angular",
"target": "^1.0.8"
},
"canonicalDir": "/home/ricco/.cache/bower/packages/060a9fe0e60a0d3d6c9ed350cde03e61/1.5.4",
"pkgMeta": {
"name": "angular",
"version": "1.5.4",
"license": "MIT",
"main": "./angular.js",
"ignore": [],
"dependencies": {},
"homepage": "https://github.com/angular/bower-angular",
"_release": "1.5.4",
"_resolution": {
"type": "version",
"tag": "v1.5.4",
"commit": "b972d5aa130bef5c4d931f22bd11627207ea35ca"
},
"_source": "https://github.com/angular/bower-angular.git",
"_target": ">=1"
},
"dependencies": {},
"nrDependants": 1
}
},
"nrDependants": 1
}
]
}
]
}
}, {
"type": "input",
"message": "Answer",
"name": "prompt",
"level": "prompt"
之后,
{
"type": "input",
"message": "Answer",
"name": "prompt",
"level": "prompt"
由于某种原因它被困在那里。
这是我的bower.json
{
"name": "ng-boilerplate",
"version": "0.3.2",
"devDependencies": {
"angular": "~1.2",
"angular-mocks": "~1.2",
"bootstrap": "~3.1",
"angular-bootstrap": "~0.10.0",
"angular-ui-router": "~0.2",
"angular-route":"1.5.3",
"angular-resource":"1.5.3"
},
"dependencies": {}
}
答案 0 :(得分:42)
我使用Angular样板ngbp遇到了同样的问题。
我通过从107
文件中删除以下行来解决了这个问题:
.bowerrc
或者,请参阅@NikolaB的answer below。这包括将"json": "bower.json"
添加到resolutions
而不是删除此行。
答案 1 :(得分:1)
当您通过Bower为您的应用指定依赖关系时,某些包可能依赖于同一个库的不同版本。您必须在应用中解决所需的库版本。
如果你在.bowerrc文件中使用“json”:“bower.json”配置Bower,Bower会希望这些分辨率在bower.json文件中。这意味着您必须在bower.json文件中包含“resolutions”属性。
所以,你可以尝试在你的bower.json中添加“resolutions”属性:
{
"name": "ng-boilerplate",
"version": "0.3.2",
"devDependencies": {
"angular": "~1.2",
"angular-mocks": "~1.2",
"bootstrap": "~3.1",
"angular-bootstrap": "~0.10.0",
"angular-ui-router": "~0.2",
"angular-route":"1.5.3",
"angular-resource":"1.5.3"
},
"resolutions": {
"angular": "1.2.12"
}
}