Documentation

Where's the node_modules directory?

I've set up my node step build and have a package.json committed to my git repository, but when I create and sync a bundle there isn't a node_modules directory on the filesystem. Has the npm install command failed?

If you have a node build step set up, you might notice that the node_modules directory isn't included in your bundles. This is done intentionally for a few reasons:

  1. Deploy speed - By excluding them from the bundle, we make deployments a lot faster. Sometimes the node_modules directory can reach hundreds of megabytes, which has to be downloaded by our platform when synced to one of your project environments.
  2. Security - Often old, unmaintained or unpatched npm packages can present security exploits when stored on your web server, so it's often safer to discard then afterwards.
  3. Redundant - Most of time the node_modules aren't needed once the front-end assets have been compiled.
  4. Node isn't installed - By default, we don't have Node installed on our PHP instances so any JS files can't be executed.

If this presents a problem for your project, feel free to get in touch via our support and we can work something out.