javascript - Updating AngularJS from 1.5.0 to 1.5.8 - Stack Overflow

I have the following bower.json file:{"private": true,"dependencies": {"angu

I have the following bower.json file:

{  
  "private": true,
  "dependencies": {
    "angular": "~1.5.0",
    "angular-mocks": "^1.5.7",
    "bootstrap": "^3.3.6",
    "bootstrap-rtl": "^3.4.0",
    "font-awesome": "^4.6.3",
    "moment": "^2.13.0",
    "angular-animate": "^1.5.6",
    "angular-sanitize": "^1.5.6",
    "angular-ui-router": "~0.2.15",
    "angular-translate": "^2.11.0",
    "angular-touch": "^1.5.7",
    "angular-messages": "^1.5.6",
    "angular-cookies": "^1.5.8",
    "angular-ui-grid": "^3.1.1",
    "angular-ui-sortable": "^0.14.2",
    "angular-bootstrap-affix": "^0.2.2",
    "theia-sticky-sidebar": "^1.4.0",
    "angular-ui-router-title": "^0.0.4",
    "angularjs-slider": "^4.0.2",
    "angular-fcsa-number": "^1.5.3",
    "angularPrint": "angular-print#^0.3.8",
    "ng-virtual-keyboard": "^0.3.0",
    "keyboard": "^1.26.1",
    "angular-spinner": "^0.8.1",
    "ng-ip-address": "^1.1.10",
    "file-saver": "^1.3.2",
    "ng-iban": "^1.1.0",
    "pdfmake": "^0.1.20",
    "ng-device-detector": "^3.0.1",
    "checklist-model": "^0.10.0",
    "angular-dynamic-number": "^2.1.1",
    "ng-file-upload": "^12.2.13",
    "ng-file-upload-shim": "^12.2.13",
    "angular-ui-select": "^0.19.6",
    "angular-dragula": "^1.2.8",
    "angular-drag-and-drop-lists": "^2.0.0",
    "angular-slick-carousel": "^3.1.7",
    "angular-slick": "^0.2.1",
    "drag-drop-webkit-mobile": "^1.2.0",
    "iban": "^0.0.8",
    "highcharts": "^5.0.9"
  }
}

I want to update only AngularJS to version 1.5.8. What is the best way to do this update without any headache? I tried to install bower install angular#1.5.8 --save , but when other team members entered bower-update their whole project broke because a lot of packages where updated. Any bright idea how to only update AngularJS?

I have the following bower.json file:

{  
  "private": true,
  "dependencies": {
    "angular": "~1.5.0",
    "angular-mocks": "^1.5.7",
    "bootstrap": "^3.3.6",
    "bootstrap-rtl": "^3.4.0",
    "font-awesome": "^4.6.3",
    "moment": "^2.13.0",
    "angular-animate": "^1.5.6",
    "angular-sanitize": "^1.5.6",
    "angular-ui-router": "~0.2.15",
    "angular-translate": "^2.11.0",
    "angular-touch": "^1.5.7",
    "angular-messages": "^1.5.6",
    "angular-cookies": "^1.5.8",
    "angular-ui-grid": "^3.1.1",
    "angular-ui-sortable": "^0.14.2",
    "angular-bootstrap-affix": "^0.2.2",
    "theia-sticky-sidebar": "^1.4.0",
    "angular-ui-router-title": "^0.0.4",
    "angularjs-slider": "^4.0.2",
    "angular-fcsa-number": "^1.5.3",
    "angularPrint": "angular-print#^0.3.8",
    "ng-virtual-keyboard": "^0.3.0",
    "keyboard": "^1.26.1",
    "angular-spinner": "^0.8.1",
    "ng-ip-address": "^1.1.10",
    "file-saver": "^1.3.2",
    "ng-iban": "^1.1.0",
    "pdfmake": "^0.1.20",
    "ng-device-detector": "^3.0.1",
    "checklist-model": "^0.10.0",
    "angular-dynamic-number": "^2.1.1",
    "ng-file-upload": "^12.2.13",
    "ng-file-upload-shim": "^12.2.13",
    "angular-ui-select": "^0.19.6",
    "angular-dragula": "^1.2.8",
    "angular-drag-and-drop-lists": "^2.0.0",
    "angular-slick-carousel": "^3.1.7",
    "angular-slick": "^0.2.1",
    "drag-drop-webkit-mobile": "^1.2.0",
    "iban": "^0.0.8",
    "highcharts": "^5.0.9"
  }
}

I want to update only AngularJS to version 1.5.8. What is the best way to do this update without any headache? I tried to install bower install angular#1.5.8 --save , but when other team members entered bower-update their whole project broke because a lot of packages where updated. Any bright idea how to only update AngularJS?

Share Improve this question edited Mar 28, 2017 at 11:32 lin 18.4k4 gold badges66 silver badges87 bronze badges asked Mar 28, 2017 at 10:38 RathmaRathma 1,3232 gold badges34 silver badges68 bronze badges 11
  • It should not break while you using ^ which just update minor package versions. Just run bower update and see what happends. "It should" - this is truly depending on the packages and its developers. – lin Commented Mar 28, 2017 at 10:42
  • Try updating the bower.json file, delete angularjs from your bower_ponents and then run bower install. It should only install the missing dependency. – fubar Commented Mar 28, 2017 at 10:44
  • @Lin angular-messages, angular-animation and lots of other dependencies where updated to 1.6.x version which caused project to break. – Rathma Commented Mar 28, 2017 at 10:51
  • 1 NPM has a shrinkwrap feature allowing you full control over your dependencies but also your nested dependencies (3rd party dependencies). There is a github issue to implement such a feature for Bower. However a quick Google brought up loads of libs that claim to achieve the same behavior for Bower. We implemented shrink-wrapping in NPM and these issues haven't arisen since. Just FYI really. – ste2425 Commented Mar 28, 2017 at 10:57
  • 1 Try "angular": "1.5.8", and run bower update not bower-update. You may going to switch to tilde ~ on all your dependencies to ensure only the minor versions going to updated. – lin Commented Mar 28, 2017 at 11:00
 |  Show 6 more ments

2 Answers 2

Reset to default 5

Try "angular": "1.5.8", and run bower update not bower-update. You may going to switch to tilde ~ on all your dependencies to ensure only the minor versions going to be updated. Note that angular-mocks is not corresponding with the AngularJS version.

In the simplest terms, the tilde matches the most recent minor version (the middle number). ~1.2.3 will match all 1.2.x versions but will miss 1.3.0.

The caret, on the other hand, is more relaxed. It will update you to the most recent major version (the first number). ^1.2.3 will match any 1.x.x release including 1.3.0, but will hold off on 2.0.0.

{
    "private": true,
    "dependencies": {
        "angular": "1.5.8",
        "angular-mocks": "~1.5.7",
        "bootstrap": "~3.3.6",
        "bootstrap-rtl": "~3.4.0",
        "font-awesome": "~4.6.3",
        "moment": "~2.13.0",
        "angular-animate": "~1.5.6",
        "angular-sanitize": "~1.5.6",
        "angular-ui-router": "~0.2.15",
        "angular-translate": "~2.11.0",
        "angular-touch": "~1.5.7",
        "angular-messages": "~1.5.6",
        "angular-cookies": "~1.5.8",
        "angular-ui-grid": "~3.1.1",
        "angular-ui-sortable": "~0.14.2",
        "angular-bootstrap-affix": "~0.2.2",
        "theia-sticky-sidebar": "~1.4.0",
        "angular-ui-router-title": "~0.0.4",
        "angularjs-slider": "~4.0.2",
        "angular-fcsa-number": "~1.5.3",
        "angularPrint": "angular-print#~0.3.8",
        "ng-virtual-keyboard": "~0.3.0",
        "keyboard": "~1.26.1",
        "angular-spinner": "~0.8.1",
        "ng-ip-address": "~1.1.10",
        "file-saver": "~1.3.2",
        "ng-iban": "~1.1.0",
        "pdfmake": "~0.1.20",
        "ng-device-detector": "~3.0.1",
        "checklist-model": "~0.10.0",
        "angular-dynamic-number": "~2.1.1",
        "ng-file-upload": "~12.2.13",
        "ng-file-upload-shim": "~12.2.13",
        "angular-ui-select": "~0.19.6",
        "angular-dragula": "~1.2.8",
        "angular-drag-and-drop-lists": "~2.0.0",
        "angular-slick-carousel": "~3.1.7",
        "angular-slick": "~0.2.1",
        "drag-drop-webkit-mobile": "~1.2.0",
        "iban": "~0.0.8",
        "highcharts": "~5.0.9"
    }
}

Only updating your angular package will work locally, but when a new project needs to be setup and you want to install your dependencies you'll run into this problem any ways. I suggest you setup your dependencies how you want them and make sure you don't allow deviations to version you don't want to get installed. I'll add some info on how interpret the version numbers.

Using bower update <package_name> will update only that package to the version listed in the bower.json

Assume a version number like this: 1.5.0. Each number has a mean, 1 is the major version, 5 is the minor version and 0 is the patch number. So like this major.minor.patch

A caret (^) means you can't change major version, but you can change minor and patch version. So ^1.5.0 can range from 1.5.0 until but no including 2.0.0. So in your cause because you had ^1.5.0, Angular will update to the latest non-major version change which is 1.6.3

A tilde (~) means only the patch version change (or minor version if patch isn't specified in the version)

Read more about it here: semver

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744661192a4586472.html

相关推荐

  • javascript - Updating AngularJS from 1.5.0 to 1.5.8 - Stack Overflow

    I have the following bower.json file:{"private": true,"dependencies": {"angu

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信