Heroku, node.js: stop downloading node_modules on each deploy

Currently Heroku reinstalls all dependencies each time I deploy my app. It can possibly break something if a new version of a dependency has a bug or not compatible with my current setup. Is there a way to tell heroku to download dependencies only when I change version in the package.js (just like they do it on dotCloud)?

Unless there is a bug in Heroku, the way to block a package is to use a specific version of your dependencies inside your package.json. Take a look at the node.js page.

sample package.json:

{
  "name": "appname",
  "version": "0.0.1",
  "dependencies": {
    "express": "2.5.8"
  },
  "engines": {
    "node": "0.8.x",
    "npm": "1.1.x"
  }
}