Building it Brick by Brick

Clean Heroku npm cache

Today I ran into an issue with Heroku and the way its official buildpack for Node caches node_modules. Namely, I was forced to fork a couple of modules so I updated package.json to point to GitHub repositories (see this tip).

Unfortunately, Heroku stubbornly refused to modules from the updated path and actually npm wasn't behaving much better on my local machine either but there at least I could manually delete the node_modules and re-install everything. Committing and pushing minor updates to package.json didn't help so I finally looked into buildpack's code

It turns out that it always runs npm prune on cached modules so I decided to leverage that. So to clear the modules cache: