How to set package latest version in Bower?
Asked Answered
C

5

44

I was watching this nice video about requirejs, backbone and bower and something does not work for me. How can I set latest version of package in bower.json file? In video Jeff says that null should be used to define latest version like this

{
    "name": "project name",
    "version": "1.0.0",
    "dependencies": {
        "backbone-amd": null,
        "underscore-amd": null,
        "requirejs": null
    }
}

But I have an exception in console that I can't use null value as version number. I couldn't find any info at bower wiki. Does anybody know how to solve this?

Chinaware answered 15/9, 2013 at 18:2 Comment(2)
What's your bower version? It works or me with 1.1.2Kiosk
I've got it. I have 0.10.0 versionChinaware
I
15

That should work.

Make sure you are running the latest version of Bower. I am currently running v1.2.6 and null works to fetch the latest dependency.

$ bower -v

If you have installed bower globally via npm, then you can update it this way:

$ npm update bower -g

Note: you may need to run that as sudo depending on your file permissions.

Hope this helps.

Isidora answered 15/9, 2013 at 18:47 Comment(1)
Right, I've installed bower few months agoChinaware
F
80

If you are using bower version 1.2.x, this should work:

{
    "name": "project name",
    "version": "1.0.0",
    "dependencies": {
        "backbone-amd": "latest",
        "underscore-amd": "latest",
        "requirejs": "latest"
    }
}
Footpoundal answered 30/9, 2013 at 10:35 Comment(0)
J
26

You can use the latest keyword when installing a package. Be aware that you can get some dependencies issues :

bower install --save font-awesome#latest
bower font-awesome#4.1.0    not-cached git://github.com/FortAwesome/Font-Awesome.git#4.1.0
bower font-awesome#4.1.0       resolve git://github.com/FortAwesome/Font-Awesome.git#4.1.0
bower font-awesome#4.1.0      download https://github.com/FortAwesome/Font-Awesome/archive/v4.1.0.tar.gz
bower font-awesome#4.1.0       extract archive.tar.gz
bower font-awesome#4.1.0      resolved git://github.com/FortAwesome/Font-Awesome.git#4.1.0

There is a -F flag that can go even further:

-F, --force-latest      Force latest version on conflict
Judgemade answered 26/5, 2014 at 14:8 Comment(1)
just to clear it up, doing bower install --save font-awesome#latest even though you already have font-awesome saved in your bower.json as an older version, will prompt you to select the newer version and overwrite it.Deville
I
16

I have found an easy alternative, instead of updating manually, you could use one command:

First install this:

npm install -g bower-check-updates

Then run the bcu to check for the updates

bcu

After check, bcu -u to upgrade your bower.json and its done!

More details and source:

bower-check-updates - is totally clone of npm-check-updates, but it updates bower.json dependencies (bower-check-updates updates bower.json).

Source: https://www.npmjs.com/package/bower-check-updates

Idioblast answered 11/6, 2016 at 16:58 Comment(0)
I
15

That should work.

Make sure you are running the latest version of Bower. I am currently running v1.2.6 and null works to fetch the latest dependency.

$ bower -v

If you have installed bower globally via npm, then you can update it this way:

$ npm update bower -g

Note: you may need to run that as sudo depending on your file permissions.

Hope this helps.

Isidora answered 15/9, 2013 at 18:47 Comment(1)
Right, I've installed bower few months agoChinaware
M
1
npm install -g npm-check-updates
npm-check-updates --packageManager bower 

source: https://www.npmjs.com/package/bower-check-updates

Mattingly answered 12/7, 2019 at 9:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.