node.jsexpressherokunpm-version

Push rejected, failed to compile Node.js app on heroku App


I have added node_modules in .gitignore that's not issue!

How to solve this errors because in engines I have specified version of both.
enter image description here Here is Code :

{
  "name": "server",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  
  "engines": {
    "node":"12.6.2",
    "npm":"6.14.4"
  },
  "scripts": {
    "start": "node index.js"
  },
  "author": "smeet_kothari",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1"
  }
}

and this is my index.js file enter image description here

And Code of index.js file.

const app = express();

app.get('/', (req,res) => {
    res.send({hi:'there'});
});

const PORT = process.env.PORT || 5000;
app.listen(PORT); 
G:\01) Web Development\10) nodejs project\[FreeCourseSite.com] Udemy - Node with React Fullstack Web Development\MailFeed\server>heroku -v
heroku/7.47.7 win32-x64 node-v12.16.2

Procfile has been added too! enter image description here

Thanks for solution in advance!


Solution

  • Seems like you have not defined Procfile for the project try it first if still not solved comment the total error appearing in the command line