Running git push heroku master
always triggers a step that prompts:
Installing dependencies with npm
This step loads and reinstalls all of the dependencies again even it already exists. This is very time consuming and I want to skip this step sometimes when I deploy that I know the dependencies are the same.
Is there any command or options that do this?
Its been a long time since you asked this question, now the Heroku buildpack caches node_modules
, so install times will be much faster.
If however you still want to block npm install
, here is one solution.
As of when I write this, the default Heroku build pack does not allow skipping npm install entirely. You can see in the dependencies.sh file, this line will always run:
npm install --unsafe-perm --userconfig $build_dir/.npmrc 2>&1
However, if you create a file called .npmrc
in your project folder with the following contents:
dry-run
This will cause npm install to not modify your existing node_modules
directory.
Note that this change will also apply to the npm prune
command that Heroku runs, but WILL NOT apply to the npm rebuild
command (which is probably fine).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With