- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我的项目需要 angular-leaflet,angular-leaflet 有一个 long list of devDependencies ,包括 jQuery 2。我不想要 jQuery 2——我想要 jQuery 1.x。我怎样才能让 bower 忽略 angular-leaflet 的 devDependencies 并让我使用 jQuery 1?
我正在使用 Bower 1.2.8。这是为我重现问题的最小 bower.json:
{
"name": "bower-test",
"dependencies": {
"jquery": "1.x",
"angular": "1.2.x",
"angular-leaflet": "0.7.x"
}
}
运行 bower install
导致以下错误:
Unable to find a suitable version for jquery, please choose one:
1) jquery#1.x which resolved to 1.11.0 and has bower-test as dependants
2) jquery#2.1.0 which resolved to 2.1.0 and has angular-leaflet#0.7.5 as dependants
3) jquery#>= 1.9.0 which resolved to 2.1.0 and has bootstrap#3.0.3 as dependants
至少,我希望 bower install --production
忽略 angular-leaflet 中的 devDependencies。但这是结果(与上面相同):
Unable to find a suitable version for jquery, please choose one:
1) jquery#1.x which resolved to 1.11.0 and has bower-test as dependants
2) jquery#2.1.0 which resolved to 2.1.0 and has angular-leaflet#0.7.5 as dependants
3) jquery#>= 1.9.0 which resolved to 2.1.0 and has bootstrap#3.0.3 as dependants
为什么 bower 不忽略 angular-leaflet 的 devDependencies?有没有办法让它这样做?
最佳答案
我认为您正在寻找的解决方案是 bower.json
的 resolutions
部分至于为什么要分析你的 dependencies
的 devDependencies
我不清楚。
{
"name": "bower-test",
"dependencies": {
"jquery": "1.x",
"angular": "1.2.x",
"angular-leaflet": "0.7.x"
},
"resolutions": {
"jquery": "1.x"
}
}
也许这与 npm
的细微差别在于执行 bower install xyz
包括 devDependencies
除非 -p
或 --production
参数已指定,但即使已指定,它似乎也不会传递给 dependencies
- 也许这是一个错误.
更新:问题似乎与使用 angular-leaflet
的这个特定包/设置有关。其他组件没有这个问题。例如,bower install webmaker-analytics
只获取 webmaker-analytics
,而不是 qunit
,即使它列在这个包的 devDependencies
中也是如此。 .
关于javascript - Bower 在生产中加载 devDependencies?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22155420/
我正在开发一个需要能够平均三个数字的 Facebook 应用程序。但是,它总是返回 0 作为答案。这是我的代码: $y = 100; $n = 250; $m = 300; $number = ($y
我只是无法弄清楚这一点,也找不到任何对我来说有意义的类似问题。我的问题:我从数据库中提取记录,并在我的网页上以每个面板 12 条的倍数显示它们。因此,我需要知道有多少个面板可以使用 JavaScrip
我是一名优秀的程序员,十分优秀!