I have a Node.js app with npm-shrinkwrap.json
checked in. When I run npm install
locally, it installs the versions specified in npm-shrinkwrap.json
, but when I push it to Heroku (on the Cedar stack), it seems to ignore the shrinkwrap and simply installs the newest version.
Am I doing something wrong? I don't need to to check in node_modules
, do I?
As you say in your answer, when Heroku wrote the Nodejs buildpack, the feature npm shrinkwrap
didn't exist.
However, as of version 1.1.2, npm install
tries npm-shrinkwrap.json
first, falling back to package.json
. This means that Heroku respects it (even though the feature hadn't been conceived when Heroku wrote their code). Isaacs is awesome.
So just add to your package.json
:
"engines": {
"node": "0.8.x",
"npm": ">=1.1.2"
}
Then run npm shrinkwrap
, and git add npm-shrinkwrap.json
. Then commit as normal.
As it turns out, Heroku uses npm 1.0.106 at the moment, but shrinkwrap
was only added in npm 1.1.2, according to the changelog.
Adding node_modules
has solved my problem, until Heroku upgrade their npm.