Changes to the way executables from installed node_modules are exposed at build time

As part of Netlify Build experience, when a customer installs node modules that expose some sort of executable, we expose said executables in the build command environment so that you can call them at build time.

We want to keep supporting said behaviour, however it has come to our attention that our current setup could lead to rather confusing build failures - 'gatsby build' works locally but not on Netlify. This is a bug in our platform that we intend to address. In order to do so though we’ll be changing the order through which these executables are added to the build command execution context and (even if highly unlikely) it could have some consequences.

What will change?

The order through which we add the executables in the ./node_modules/.bin directory to our build command environment will change so that any system wide executable takes precedence. As an example, if you’ve installed the npm package in your project by having it listed as a dependency in your package.json or by doing npm install npm, running npm afterwards will still use the system wide npm executable we’ve setup for your project when we kicked off your build.

Will I be affected?

Although highly unlikely, this could affect your execution if you install via npm (or other JS package manager for that matter) and later run any of the tools and packages we already expose to your build. Refer to our list of software available at build time.

What to do if I’m affected

You can still run your specific executable if you really want to. To do so you can either access and run the package directly by calling it under node_modules/.bin or, as better more future proof alternative, use the execution tools provided by your package manager of choice: