How do I use npm link with Heroku?

I'm using npm link as described here

http://npmjs.org/doc/link.html

Locally everything works perfectly. When I deploy to Heroku I get the error message

Error: Cannot find module '...'

How can I get this working with Heroku?

I wish there were an elegant solution to this (it would make my life a hell of a lot easier). Your custom package is symlinked into node_modules by npm link, but git doesn't follow symbolic links nowadays. So when you git push to Heroku, there's no way to make your custom packages go along for the ride.

Note, however, that from my experiments, Heroku will honor any node_modules you do push in, instead of trying to install them from the network. It just runs npm install --production, essentially. Perhaps a hard link directly to the development source of your package would do the trick, but I'm not sure whether Git would play nicely with that. Use at your own risk!

EDIT: If you want to know exactly what Heroku does, it's all open source.

The ideal situation would be to get the packages, if they're open source, onto NPM itself. Which is pretty painless and automatic.