Home
Support Forums

Disabling javascript dependencies install

Hey

I need to completely disable the automatic npm install / yarn install, i have my own custom install command, and having the also the default install command takes long time.

Is there a way to achieve that?

Thanks!

Bnaya

Hi @Bnaya,

No, it’s not possible at the moment. Netlify will install all dependencies, languages and frameworks that your project might need and only then proceed to the build command.

This works fine for a lot of people, could you please explain as to what your use case is that won’t work fine with this workflow? We can file a feature request accordingly.

Hey @hrishikesh, thank you for the replay!
I have an existing codebase with some custom dependency bootstrapping strategy, that includes deleting previous node_modules + patching some of the packages.
That means that out of the box I’m “paying” for double dependencies install + caching behaviour that does not benefits me and takes a a lot of time.

What i’ve end up doing is:

[build]
  base = "trick-netlify/"
  publish = "../packages/web/build"
  command = "cd ../ && yarn bootstrap && yarn build:web"
  ignore = "exit 1"

[build.environment]
  NETLIFY_USE_YARN = "true"

Where trick-netlify contains minimal package.json that takes no time to install and to try and cache.

Controlling the deps installation & cacheing behaviour is part of any modern CI, the good ones also let you configure multiple separated caches with cache keys that are based on a hash of the lock file and other parameters.

Thanks again!

Bnaya

Hi @Bnaya,

Thank you for the response. It looks like Netlify’s build system is not suitable for your use case at the moment. While I can get this files as a feature request, we don’t know if/when this will get implemented as I’ve seen this being requested for the first time.

Meanwhile, I’d advise building elsewhere (for example GitHub Actions), and publishing to Netlify using Netlify CLI or API.

Thanks!

My workaround is working nicely, so no rush, but I definitely think it will make the product much better!