Reputation: 238
I'm a relative newcomer to the node community. I recently got on board so that I could put together a build for a complex web application that's been under development for several years. The two key tools in my build are Grunt and Browserify, but the application uses jQuery, Backbone, d3 and a smattering of other libraries and plugins as well.
A problem that I've been running into is this: by default, when I install and save a package with npm, it sets up the package with a semver expression that captures all future releases of the package whenever you run npm update
. Like this article explains well, that may seem like a good thing at first ("give me this package and all future upgrades"), but it exposes your own application to any non-backwards compatible updates the package maintainer makes... The article also provides some recommended best practices, but it was written almost 4 years ago to the day; I'm hoping there are other, newer ideas.
What sort of solutions do you use to resolve this issue? I can't keep wasting time updating my software every time a breaking change is made in a library I rely on. I want to update when I am good and ready, not whenever I run npm update
.
Upvotes: 4
Views: 2516
Reputation: 20633
Use npm shrinkwrap to save the tree of dependencies containing the exact versions, so when you npm install
it'll use those exact versions.
The npm outdated
command will tell you what packages are outdated.
Instead of npm update
which updates all your packages, update specific packages with npm install <pkg>@<version> --save
Upvotes: 3