Bower安装目录更改:有时会附加版本 [英] Bower installation directory changes: sometimes the version is appended
问题描述
我有一个使用Bower的项目。
I have a project that uses bower.
我的bower.json:
My bower.json:
{
"name": "myproject",
"version": "0.0.0",
"dependencies": {
...
"angular-sanitize": "1.2.1",
...
然后我运行bower安装。
Then I run bower install.
然后我可以看到安装了什么:
Then I can see what's installed:
➜ myproject git:(develop) ✗ ls app/bower_components/angular-sanitize/
README.md angular-sanitize.min.js bower.json
angular-sanitize.js angular-sanitize.min.js.map
但是随后一位同事签出该项目,他
s,在他的机器上,此依赖项安装在
But then a coworker checkouts the project, he bower install
s, on his machine, this dependency is installed in
app / bower_components / angular-sanitize / bower-angular -sanitize-v1.2.1 /
而不是我原来的
app / bower_components / angular-sanitize /
。
所以为什么d oes bower有时会在安装文件夹中添加bower-angular-sanitize-v1.2.1 /?
So why does bower sometimes adds bower-angular-sanitize-v1.2.1/ to the installation folder ?
注意事项:我们具有相同的bower.json和bower版本。如果我删除bower_dependencies并重新安装,我仍然有旧文件夹。
Notes: We have the same bower.json and version of bower. If I delete my bower_dependencies and reinstall, I still have the old folder.
编辑:
我的理解(在凉亭玩了一会后,安装了删除bower_components,清除凉亭缓存等)...
What I understand (after playing a while with bower install a removing bower_components, clearing bower cache etc)...
我的问题与凉亭如何解决决议有关。看来一旦Bower提示您选择一些版本(jQuery,Angular和Bootstrap),版本就会解决。
My problem is linked to how bower resolves resolutions. It seems that versions are resolved once bower prompts you with a choice for choosing a few version (jquery, angular and bootstrap).
但是,我仍然要注意一些事情不明白:
But still, a few things that I don't understand:
-
在我的机器上,即使在删除Bower缓存,删除bower_dependencies或在新版本中复制bower.json之后文件夹中,bower从不会在 bower安装后提示我有关解决方案的信息(那么它们如何存储?)
On my machine, even after removing bower cache, removing bower_dependencies or copying the bower.json in a new folder, bower never prompts me about resolutions after a "bower install" (so how are they stored?)
在我的同事计算机上,bower仅提示解决方案
On my coworker machine, bower prompts for resolutions only on his native system (and not when "bower install"ing in a vagrant machine).
在他的本机系统上(而不是在无所事事的机器上进行 bower安装时)。还有一些晦涩的地方:
bower如何存储依赖项解析? 我唯一发现的地方是关于github问题(并通过玩弄它)。
So, I have a few more obscure points: How does bower store the dependencies resolutions ? Is there documentation about this anywhere ? The only place I have found something is on some github issues (and by playing around with it).
我的凉亭。 json:
My bower.json:
{
"name": "myproject",
"version": "0.0.0",
"dependencies": {
"json3": "~3.2.4",
"bootstrap-sass": "~2.3.1",
"es5-shim": "~2.0.8",
"angular-cookies": "~1.2.1",
"angular-dragdrop": "<=1.0.4",
"angular-strap": "~0.7.1",
"angulartics": "~0.8.4",
"jquery": "~1.8.3",
"underscore": "~1.4.4",
"angular": "1.2.1",
"angular-route": "1.2.1",
"angular-resource": "1.2.1",
"angular-sanitize": "1.2.1",
"angular-ui-date": "~0.0.3",
"jquery.masonry": "v2.1.08",
"bootstrap": "~2.3.1",
"angular-bootstrap": "~0.10.0",
"highcharts": "~3.0.2",
"jqueryui-timepicker-addon": "~1.4",
"moment": "~2.0.0",
"bootstrap-notify": "0.1.0",
"mjaalnir-bootstrap-colorpicker": "~1.0.0"
},
"devDependencies": {
"angular-mocks": "~1.0.7",
"angular-scenario": "~1.0.7"
},
"resolutions": {
"jquery": "~1.8.3",
"angular": "1.2.1",
"bootstrap": "~2.3.1"
}
}
推荐答案
我们在这里遇到了同样的问题-决议何时定义在 bower.json
内,安装时具有空的缓存和空的 bower_components
目录,该软件包将安装到 bower_components / package / package-version
,而如果您在安装过程中以交互方式选择解决方案 ,则它将安装到 bower_components / package code>-因此,如果遇到此问题,请清理缓存(例如
清除缓存缓存
),删除已安装的组件(例如 rm -rf bower_components /
)并删除决议
来自 bower.json
,然后 bower安装
。
We have the same problem here - it seems when the resolutions are defined within bower.json
on install with empty cache and an empty bower_components
directory, the package gets installed into bower_components/package/package-version
whereas if you select the resolutions interactively during install, then it gets installed into bower_components/package
- so if you hit that problem, clean the cache (e.g. bower cache clean
), delete installed components (e.g. rm -rf bower_components/
) and remove the resolutions
from bower.json
and then bower install
.
这篇关于Bower安装目录更改:有时会附加版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!