简体   繁体   中英

Bower Install breaking npm install

Locally my bower and npm install work just fine but when I deploy cricleCI build fails and gives me:

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

The only thing that changed from before is I ran some bower update and set a resolution for my ngSanitize based on 1.4.6 while everything else is on 1.3

I was able to fix my npm install by updating and setting a resolution but now I get this.

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)

I had the same issue with my builds (using TeamCity). I ended up removing bower from the post-install script in the package.json file and added a bower install command as a separate step in the build process.

This is what the offending line in package.json looks like:

"postinstall": "bower install",

This line indicates that there're more than one angular version to choose:

bower ECONFLICT Unable to find suitable version for angular

It should normally be something like Unable to find a suitable version for angular, please choose one: and the list of options below it. Since you can't select any version, it can't continue and since bower install called by some post script, it also breaks npm process as well.

The most easiest way to overcome this problem is using compatible packages but it's not always possible since they are being updated by different person/people. So I recommend you to use another bower feature which is called "resolutions".

Here's the small explanation: https://github.com/bower/bower.json-spec#resolutions

Dependency versions to automatically resolve with if conflicts occur between packages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM