I am following a tutorial from a book, we have just set up a heroku based mongodb database alongside a local database. The local app works fine but when I run it on Heroku I get the following error
/app/node_modules/mongoose/lib/index.js:7
const Schema = require('./schema');
^^^^^
SyntaxError: Use of const in strict mode.
I'm guessing that the fact the version of Node on Heroku is different to my localhost but maybe it is not.
when I do node --version on my local I get
v8.9.3
when I do it on Heroku I get
v0.10.48
which is a bit confusing.
How can I fix this so that it runs on Heroku. I have contacted their support but they sent me here as it is an application issue.
Thanks
Refer to Heroku documentation . If you want to have a specific version of nodejs, which for example supports const
use the engines section of your package.json
.
Sample from Heroku:
{
"name": "myapp",
"description": "a really cool app",
"version": "1.0.0",
"engines": {
"node": "8.9.4"
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.