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 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
.
Further documentation: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version