How to update grunt devDependencies?
In your package.json
you can tag each dependency with a range of versions to install then type npm install
to install all the listed dependencies at the given versions:
Only install 0.6.0
:
{
"devDependencies": {
"grunt-contrib-watch": "0.6.0"
}
}
Prefix with ~
to install the latest patch version 0.6.x
:
As 0.6.1
, 0.6.2
, 0.6.3
, etc versions are released, npm install
will install the latest version of those. If 0.7.0
is release, it will not install that version (generally a good strategy as it may contain breaking changes).
{
"devDependencies": {
"grunt-contrib-watch": "~0.6.0"
}
}
Explicitly set the range:
You can use >
, <
, <=
, >=
to explicitly set the version range. Another good option for custom ranges or if you would like to be explicit with your version ranges. The follow will install every version greater or equal than 0.6.0
but less than 1.0.0
:
{
"devDependencies": {
"grunt-contrib-watch": ">= 0.6.0 < 1.0.0"
}
}
Always install the latest with *
Or if you just always want the latest version use *
:
{
"devDependencies": {
"grunt-contrib-watch": "*"
}
}
See more about version ranges in the npm docs: https://www.npmjs.org/doc/misc/semver.html
npm outdated
If you would like to see which of your dependencies are out of date, use npm outdated
: https://www.npmjs.org/doc/cli/npm-outdated.html
npm update
Use npm update
to update all your dependencies to the latest versions. Or npm update packagename anotherpackage
to update specific packages to the latest version.