0
votes

My listen Method

app.listen(process.env.PORT || 3000, function () {
    console.log("server is runing ...");
});

Procfile file

web: node app.js

Package.json file

{
    "name": "todolistv1",
    "version": "1.0.0",
    "description": "",
    "main": "app.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "author": "",
    "license": "ISC",
    "engines": {
        "node": "12.16.2"
    },
    "dependencies": {
        "body-parse": "^0.1.0",
        "ejs": "^3.1.2",
        "express": "^4.17.1",
        "lodash": "^4.17.15",
        "mongoose": "^5.9.14"
    }
}

get this Error after deploy on heroku

$ heroku logs --tail

2020-05-16T15:20:04.427942+00:00 heroku[web.1]: State changed from starting to crashed 2020-05-16T15:20:04.430891+00:00 heroku[web.1]: State changed from crashed to starting 2020-05-16T15:20:04.351554+00:00 app[web.1]: npm ERR! missing script: start 2020-05-16T15:20:04.360666+00:00 app[web.1]: 2020-05-16T15:20:04.361153+00:00 app[web.1]: npm ERR! A complete log of this run can be found in: 2020-05-16T15:20:04.361349+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-05-16T15_20_04_352Z-debug.log 2020-05-16T15:20:08.985111+00:00 heroku[web.1]: State changed from starting to crashed 2020-05-16T15:20:08.909101+00:00 app[web.1]: npm ERR! missing script: start 2020-05-16T15:20:08.915880+00:00 app[web.1]: 2020-05-16T15:20:08.916239+00:00 app[web.1]: npm ERR! A complete log of this run can be found in: 2020-05-16T15:20:08.916362+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-05-16T15_20_08_909Z-debug.log 2020-05-16T15:20:13.896448+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=lit-sea-79877.herokuapp.com request_id=90490bf7-cfed-4ed8-b019-17006ccc96b3 fwd="89.64.82.94" dyno= connect= service= status=503 bytes= protocol=https 2020-05-16T15:20:14.837519+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=lit-sea-79877.herokuapp.com request_id=f5c67a31-0e94-4e9d-bba2-b8b3f1707025 fwd="89.64.82.94" dyno= connect= service= status=503 bytes= protocol=https 2020-05-16T15:20:28.386972+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=lit-sea-79877.herokuapp.com request_id=af8eeb40-0385-4161-a7e5-b7d8ed7c131c fwd="89.64.82.94" dyno= connect= service= status=503 bytes= protocol=https 2020-05-16T15:20:30.347758+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=lit-sea-79877.herokuapp.com request_id=716339e2-c296-4815-968b-ee11e6393278 fwd="89.64.82.94" dyno= connect= service= status=503 bytes= protocol=https 2020-05-16T15:22:38.000000+00:00 app[api]: Build started by user [email protected] 2020-05-16T15:22:52.988045+00:00 heroku[web.1]: State changed from crashed to starting 2020-05-16T15:22:52.728992+00:00 app[api]: Deploy 323c9431 by user [email protected] 2020-05-16T15:22:52.728992+00:00 app[api]: Release v10 created by user [email protected] 2020-05-16T15:22:53.000000+00:00 app[api]: Build succeeded

1

1 Answers

1
votes

Your script object should have 'start' key for the heroku server to start. Try this

"scripts": {"start": "node app.js",
"test": "echo \"Error: no test specified\" && exit 1" }