Avoid npm refresh after every deployment on Heroku Avoid npm refresh after every deployment on Heroku heroku heroku

Avoid npm refresh after every deployment on Heroku


I'm the maintainer of the official Heroku Node.js Buildpack.

We have a new version of the buildpack in beta that features caching support, designed specifically for the use case you described above. You can read more about it at https://github.com/heroku/heroku-buildpack-nodejs/tree/diet#about-this-refactor

Eventually this will become the default Node.js buildpack on Heroku, but if you want to use it now you'll need to set the BUILPACK_URL config var explicitly:

heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs#diet -a my-node-appgit commit -am "fakeout" --allow-emptygit push heroku


Seems like there has recently been progress by David Dollar at the heroku-buildpack-nodejs.

In short:

heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-nodejs

See answer here:https://stackoverflow.com/a/18535675/1318839


You can add both .js and native npm packages and still avoid the "refresh", (at least the re-downloading part of the "refresh".)

Include the native packages to your node_modules/ directory. When you deploy to Heroku, npm install will skip the downloading of the package. npm rebuild is also run. It will take some time to re-compile the native packages, but it should be very bearable unless you have tons of native packages.

Sidenote: Heroku doc on what Heroku does when you push a nodejs app.

Sidenote: The npm rebuild is needed because there "are mysterious failures that can happen between node and native code modules after a node upgrade".