Here is the code i added to the app that caused it to crash on Heroku servers, removing these codes cause the app to work properly on heroku my app works with these code locally
const exphbs = require('express-handlebars')({extname:"hbs"})
app.engine('hbs', exphbs);
app.set('view engine', 'hbs');
here is the logs below
[![enter image description here][1]][1]
[1]: https://i.sstatic.net/h5Mer.png
The spread operator in object literals was introduced in Node.js v8.3.0. Looks like the app is running on an older version of Node.js on Heroku. Since you mention the app works locally, it is clear that the development and production environments are not using the same version of Node.js. You should specify the version of Node.js (should be v10+ since express-handlebars v5.0.0 dropped support for versions below Node 10) the app uses in package.json
for Heroku to use in the deployment.
From the Heroku's Node.js deployment docs:
It’s a good idea to keep your development environment and production environment as similar as possible. Therefore, make sure that your local version of Node.js matches the version you told Heroku to use in the
package.json
file. To check which version you’re running locally, at the command line, typenode --version
.