NodeJS

NodeJS #

Buildpacks allow for various configuration options (through BP_NODE_* variables in project.toml or via the environment), we try to auto-detect what’s best so here is a summary.

When does it run? #

We auto-configure when we find a npm run start in your package.json file. Otherwise, the assumption is that NodeJS is part of another language (e.g. Ruby, PHP, …) and used for the asset pipeline or similar. If you intend to run a NodeJS service, you will need to add something like this to your package.json:

1
2
3
4
5
6
{
  "name:" "my/package",
  "scripts": {
    "start": "node build/server.js"
  }
}

Auto-detected settings #

BP_NODE_RUN_SCRIPTS will be set if we find a npm run build task in your package.json.

BP_KEEP_FILES is set to dist/*:build/* to match the default of most JavaScript frameworks.

Override #

When you set your own values, these values are always respected and we will stop adding them.