Bower 安装 arcgis-js-api 失败(无法为 dojo 找到合适的版本)

Bower Install of arcgis-js-api failing (unable to find suitable version for dojo)

我在尝试 运行 以下命令时遇到以下错误:bower install arcgis-js-api

我试过安装到一个新目录,也试过在创建基础 bower.json 文件后安装。在网上搜索发现有人遇到这个问题,但没有发布解决方案。

{  
    "name": "arcgis-js-api-sample-app",  
    "version": "1.0.0",  
    "license": "Apache-2.0",  
    "dependencies": {  
        "esri": "arcgis-js-api#3.15.0"  
    },  
    "resolutions": {  
        "dojo": "v1.10.4/esri-3.14.0"  
    }  
}  

错误信息: bower install arcgis-js-api ECONFLICT 无法找到适合 dojo 的版本

完整跟踪:

$ bower install arcgis-js-api
bower arcgis-js-api#*           cached https://github.com/Esri/arcgis-js-api.git#4.3.1
bower arcgis-js-api#*         validate 4.3.1 against https://github.com/Esri/arcgis-js-api.git#*
bower dojo#v1.12.1/esri-3.20.0  cached https://github.com/Esri/dojo.git#v1.12.1/esri-3.20.0
bower dojo#v1.12.1/esri-3.20.0         validate v1.12.1/esri-3.20.0 against https://github.com/Esri/dojo.git#v1.12.1/esri-3.20.0
bower util#v1.12.1/esri-3.20.0           cached https://github.com/Esri/dojo-util.git#v1.12.1/esri-3.20.0
bower util#v1.12.1/esri-3.20.0         validate v1.12.1/esri-3.20.0 against https://github.com/Esri/dojo-util.git#v1.12.1/esri-3.20.0
bower dojox#v1.12.1/esri-3.20.0          cached https://github.com/Esri/dojox.git#v1.12.1/esri-3.20.0
bower dojox#v1.12.1/esri-3.20.0        validate v1.12.1/esri-3.20.0 against https://github.com/Esri/dojox.git#v1.12.1/esri-3.20.0
bower dgrid#v1.1.0/esri-3.20.0           cached https://github.com/Esri/dgrid.git#v1.1.0/esri-3.20.0
bower dgrid#v1.1.0/esri-3.20.0         validate v1.1.0/esri-3.20.0 against https://github.com/Esri/dgrid.git#v1.1.0/esri-3.20.0
bower dijit#v1.12.1/esri-3.20.0          cached https://github.com/Esri/dijit.git#v1.12.1/esri-3.20.0
bower dijit#v1.12.1/esri-3.20.0        validate v1.12.1/esri-3.20.0 against https://github.com/Esri/dijit.git#v1.12.1/esri-3.20.0
bower dstore#1.1.1                       cached https://github.com/SitePen/dstore.git#1.1.1
bower dstore#1.1.1                     validate 1.1.1 against https://github.com/SitePen/dstore.git#1.1.1
bower moment#2.17.1                      cached https://github.com/moment/moment.git#2.17.1
bower moment#2.17.1                    validate 2.17.1 against https://github.com/moment/moment.git#2.17.1
bower dojo#>=1.8.9                       cached https://github.com/dojo/dojo.git#1.12.2
bower dojo#>=1.8.9                     validate 1.12.2 against https://github.com/dojo/dojo.git#>=1.8.9
bower dijit#1.12.1                       cached https://github.com/dojo/dijit.git#1.12.1
bower dijit#1.12.1                     validate 1.12.1 against https://github.com/dojo/dijit.git#1.12.1
bower dojox#1.12.1                       cached https://github.com/dojo/dojox.git#1.12.1
bower dojox#1.12.1                     validate 1.12.1 against https://github.com/dojo/dojox.git#1.12.1
bower dojo-themes#1.12.1                 cached https://github.com/dojo/themes.git#1.12.1
bower dojo-themes#1.12.1               validate 1.12.1 against https://github.com/dojo/themes.git#1.12.1
bower dojo#>=1.8.1                       cached https://github.com/dojo/dojo.git#1.12.2
bower dojo#>=1.8.1                     validate 1.12.2 against https://github.com/dojo/dojo.git#>=1.8.1
bower dojo#1.12.1                        cached https://github.com/dojo/dojo.git#1.12.1
bower dojo#1.12.1                      validate 1.12.1 against https://github.com/dojo/dojo.git#1.12.1
bower                                 ECONFLICT Unable to find suitable version for dojo

我无法重现这个问题。如果我只 bower install arcgis-js-api 我可以选择我的分辨率。如果我使用你发布的 bower.json,我会收到警告,但没有错误。

Please note that, esri#3.15.0 depends on dojo#v1.10.4/esri-3.14.0 which resolved to dojo#v1.10.4/esri-3.14.0 dstore#1.1.0 depends on dojo#>=1.8.1 which resolved to dojo#1.12.2 Resort to using dojo#v1.10.4/esri-3.14.0 which resolved to dojo#v1.10.4/esri-3.14.0 Code incompatibilities may occur.

没关系,Bower 只是警告大家注意安全。

你试过了吗bower cache clean

我找到了解决办法。使用 gitBash 接口时,这似乎是 windows 机器上的一个问题。 gitBash 不允许用户交互响应 selecting 特定版本的依赖项的提示,并且只显示错误消息。

我改用 gitCMD 提示而不是 gitBash。一旦切换到 gitCMD 和 运行 相同的 bower install arcgis-js-api 命令,关于 selecting 依赖项的问题出现了,我能够成功 select 它们并完成安装。

我希望这对在 windows 上使用 Bower 的其他人有所帮助。