Why is my Node.js build failing because of an invalid semver requirement?

Resolution

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

$ node --version
v6.11.1
$ npm --version         
5.2.0
$ yarn --version
0.27.5

Use the engines section of your package.json to specify the version of those binaries to use on Heroku.

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

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