Zub Zub - 1 month ago 5
Node.js Question

Heroku logs: "missing script:start" ,even it is in :(

I am trying to deploy a simple node.js app to heroku but it keeps telling me that "missing script: start" even after adding it in the package.json
my packacge.json looks like:-

{
"name": "deploy_demo",
"version": "1.0.0",
"keywords": [
"util",
"functional",
"server",
"client",
"browser"
],
"author": "Babar",
"contributors": [],
"dependencies": {
"ejs": "^2.5.2",
"express": "^4.14.0"
},
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node main.js"
},
"license": "ISC",
"description": ""
}


my code for my entry point:
main.js

Heroku logs:
heroku logs

Note: This app is working fine in localhost server
please help me out,i am new in node.js,thanks

Answer

Use process.env.PORT to set the port in any Node.js Heroku app.

Also be sure that the code you're running on localhost is the same that's running on your Heroku app.

Comments