Why is my Node.js build failing because of no matching Node versions?

Issue

Heroku needs to know what version of Node.js to download for any app that is deployed on our platform. The convention is to specify a version requirement in the engines field of package.json.

{
  "name": "myapp",
  "description": "a really cool app",
  "version": "1.0.0",
  "engines": {
    "node": "6.11.1"
  }
}

However if a version is specified that has no matching version of Node.js then the build prints a warning and fails.

Resolution

Heroku recommends specifying the exact version of Node.js that you are using locally in the engines field. To find your version locally:

$ node --version
v6.11.1

Use the engines section of your package.json to specify the version of Node.js to use on Heroku. Drop the v to save only the version number:

{
  "name": "myapp",
  "description": "a really cool app",
  "version": "1.0.0",
  "engines": {
    "node": "6.11.1"
  }
}

You can also specify a semver range by using x as placeholders like: 8.1.x.

You can see a list of all published Node.js versions here: https://nodebin.herokai.com/v1/node/linux-x64.txt

Further documentation: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version