Bower安装打破npm安装

时间:2015-09-18 22:02:55

标签: angularjs node.js

本地我的bower和npm安装工作正常,但是当我部署cricleCI构建失败并给我时:

bower resolved      git://github.com/angular/bower-angular-sanitize.git#1.4.6
bower resolved      git://github.com/angular/bower-angular.git#1.4.6
bower resolved      git://github.com/angular/bower-angular.git#1.4.6
bower resolved      git://github.com/angular/bower-angular.git#1.4.6
bower ECONFLICT     Unable to find suitable version for angular

npm ERR! angular-seed@0.0.0 postinstall: `bower install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the angular-seed@0.0.0 postinstall script.
npm ERR! This is most likely a problem with the angular-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     bower install
npm ERR! You can get their info via:
npm ERR!     npm owner ls angular-seed
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.14.28-031428-generic
npm ERR! command "/home/ubuntu/nvm/v0.10.35/bin/node" "/home/ubuntu/nvm/v0.10.35/bin/npm" "install"
npm ERR! cwd /home/ubuntu/dashboard
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/ubuntu/dashboard/npm-debug.log
npm ERR! not ok code 0

npm install returned exit code 1

Action failed: npm install

之前唯一改变的是我运行了一些凉亭更新,并根据1.4.6为我的ngSanitize设置了分辨率,而其他一切都在1.3

我能够通过更新和设置分辨率修复我的npm安装,但现在我明白了。

Chrome 43.0.2357 (Linux) dashboardApp.version module interpolate filter should replace VERSION FAILED
    Error: [$injector:modulerr] Failed to instantiate module ngMock due to:
    Error: [$injector:unpr] Unknown provider: $$asyncCallbackProvider
    http://errors.angularjs.org/1.4.6/$injector/unpr?p0=%24%24asyncCallbackProvider
        at /home/ubuntu/dashboard/app/bower_components/angular/angular.js:68:12
        at /home/ubuntu/dashboard/app/bower_components/angular/angular.js:4287:19
        at Object.getService [as get] (/home/ubuntu/dashboard/app/bower_components/angular/angular.js:4435:39)
        at Object.decorator (/home/ubuntu/dashboard/app/bower_components/angular/angular.js:4357:41)
        at /home/ubuntu/dashboard/app/bower_components/angular-mocks/angular-mocks.js:1947:12
        at Object.invoke (/home/ubuntu/dashboard/app/bower_components/angular/angular.js:4476:17)
        at runInvokeQueue (/home/ubuntu/dashboard/app/bower_components/angular/angular.js:4382:35)
        at /home/ubuntu/dashboard/app/bower_components/angular/angular.js:4391:11
        at forEach (/home/ubuntu/dashboard/app/bower_components/angular/angular.js:336:20)
        at loadModules (/home/ubuntu/dashboard/app/bower_components/angular/angular.js:4372:5)
    http://errors.angularjs.org/1.4.6/$injector/modulerr?p0=ngMock&p1=Error%3A%20%5B%24injector%3Aunpr%5D%20Unknown%20provider%3A%20%24%24asyncCallbackProvider%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.4.6%2F%24injector%2Funpr%3Fp0%3D%2524%2524asyncCallbackProvider%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fbower_components%2Fangular%2Fangular.js%3F1442492850000%3A68%3A12%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fbower_components%2Fangular%2Fangular.js%3F1442492850000%3A4287%3A19%0A%20%20%20%20at%20Object.getService%20%5Bas%20get%5D%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fbower_components%2Fangular%2Fangular.js%3F1442492850000%3A4435%3A39)%0A%20%20%20%20at%20Object.decorator%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fbower_components%2Fangular%2Fangular.js%3F1442492850000%3A4357%3A41)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fbower_components%2Fangular-mocks%2Fangular-mocks.js%3F1442438334000%3A1947%3A12%0A%20%20%20%20at%20Object.invoke%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fbower_components%2Fangular%2Fangular.js%3F1442492850000%3A4476%3A17)%0A%20%20%20%20at%20runInvokeQueue%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fbower_components%2Fangular%2Fangular.js%3F1442492850000%3A4382%3A35)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fbower_components%2Fangular%2Fangular.js%3F1442492850000%3A4391%3A11%0A%20%20%20%20at%20forEach%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fbower_components%2Fangular%2Fangular.js%3F1442492850000%3A336%3A20)%0A%20%20%20%20at%20loadModules%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fbower_components%2Fangular%2Fangular.js%3F1442492850000%3A4372%3A5)
        at /home/ubuntu/dashboard/app/bower_components/angular/angular.js:68:12
        at /home/ubuntu/dashboard/app/bower_components/angular/angular.js:4411:15
        at forEach (/home/ubuntu/dashboard/app/bower_components/angular/angular.js:336:20)
        at loadModules (/home/ubuntu/dashboard/app/bower_components/angular/angular.js:4372:5)
        at Object.createInjector [as injector] (/home/ubuntu/dashboard/app/bower_components/angular/angular.js:4297:11)
        at workFn (/home/ubuntu/dashboard/app/bower_components/angular-mocks/angular-mocks.js:2464:52)
Chrome 43.0.2357 (Linux): Executed 1 of 6 (1 FAILED) (0 secs / 0.037 secs)

2 个答案:

答案 0 :(得分:0)

我的构建遇到了同样的问题(使用TeamCity)。我最终从package.json文件中的安装后脚本中删除了bower,并在构建过程中添加了bower install命令作为单独的步骤。

这就是package.json中的违规行:

"postinstall": "bower install",

答案 1 :(得分:0)

此行表示可以选择多个角度版本:

  

bower ECONFLICT无法为角度

找到合适的版本

通常应该是Unable to find a suitable version for angular, please choose one:以及它下面的选项列表。由于您无法选择任何版本,因此无法继续,并且由于某些帖子脚本调用了bower安装,因此它也会破坏npm进程。

解决此问题最简单的方法是使用兼容的软件包,但由于不同的人/人正在更新,因此并不总是可行。因此,我建议您使用另一种名为" resolution"。

的凉亭功能

这里有一个小解释:https://github.com/bower/bower.json-spec#resolutions

  

如果包之间发生冲突,依赖版本将自动解决。