You can certainly get this behavior by disabling the cache (which is effectively the same thing as deleting node_modules locally). In some instances, that will be the only way, because of how npm works with git dependencies.
However, in most cases it's a much better idea to specify better versions in package.json. For instance, if you specify "*" it means "this app works with literally any version of the dependency," so once that dependency is installed once, it will never be updated unless you disable the cache. Use npm install --save --save-exact mydependency to save exact versions of dependencies to package.json for more reliable npm installs everywhere, every time.
Hi. I'm the heroku node buildpack maintainer.
You can certainly get this behavior by disabling the cache (which is effectively the same thing as deleting
node_modules
locally). In some instances, that will be the only way, because of how npm works with git dependencies.However, in most cases it's a much better idea to specify better versions in package.json. For instance, if you specify "*" it means "this app works with literally any version of the dependency," so once that dependency is installed once, it will never be updated unless you disable the cache. Use
npm install --save --save-exact mydependency
to save exact versions of dependencies to package.json for more reliable npm installs everywhere, every time.