How to connect to a mongodb database on Heroku using mongoose? - javascript

Currently my app works fine locally and can connect to my local database.
Right now this is the error I am getting when i try and run it on heroku:
2014-04-17T06:32:23.404458+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T06:32:23.404460+00:00 app[web.1]: > node app.js
2014-04-17T06:32:24.052231+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T06:32:24.090050+00:00 app[web.1]: Database connection error, fcukkk: [Error: failed to connect to [localhost:27017]]
2014-04-17T06:32:24.084553+00:00 app[web.1]: Express server listening on port 23569
2014-04-17T06:32:24.630834+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T06:33:08.084028+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=9bf3db67-e00e-428a-896c-26c03dfa01ff fwd="68.99.126.105" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
2014-04-17T06:33:08.094792+00:00 app[web.1]: GET / 200 29995ms
2014-04-17T06:33:08.624842+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=pure-cliffs-4076.herokuapp.com request_id=d09fe61e-f608-47fd-9b1f-a5b4ea54a2a9 fwd="68.99.126.105" dyno=web.1 connect=1ms service=8ms status=404 bytes=193
2014-04-17T06:33:08.620901+00:00 app[web.1]: GET /favicon.ico 404 5ms
2014-04-17T06:33:44.013253+00:00 heroku[web.1]: State changed from up to starting
2014-04-17T06:33:43.925737+00:00 heroku[api]: Add mongolab:sandbox add-on by marshall.a.x#gmail.com
2014-04-17T06:33:43.925801+00:00 heroku[api]: Release v4 created by marshall.a.x#gmail.com
2014-04-17T06:33:47.537662+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-17T06:33:48.704235+00:00 he
roku[web.1]: Starting process with command `npm start`
2014-04-17T06:33:49.868707+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T06:33:49.868699+00:00 app[web.1]:
2014-04-17T06:33:49.868711+00:00 app[web.1]:
2014-04-17T06:33:49.868709+00:00 app[web.1]: > node app.js
2014-04-17T06:33:50.254949+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T06:33:50.274924+00:00 app[web.1]: Database connection error, fcukkk: [Error: failed to connect to [localhost:27017]]
2014-04-17T06:33:50.271844+00:00 app[web.1]: Express server listening on port 21153
2014-04-17T06:33:49.631038+00:00 heroku[web.1]: Process exited with status 143
2014-04-17T06:33:50.361358+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T07:38:52.772530+00:00 heroku[web.1]: Idling
2014-04-17T07:38:52.773249+00:00 heroku[web.1]: State changed from up to down
2014-04-17T07:38:56.398500+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-17T07:38:59.466635+00:00 heroku[web.1]: Process exited with status 143
2014-04-17T18:18:34.665450+00:00 heroku[web.1]: Unidling
2014-04-17T18:18:34.665450+00:00 heroku[web.1]: State changed from down to starting
2014-04-17T18:18:39.773345+00:00 heroku[web.1]: Starting process with command `npm start`
2014-04-17T18:18:41.209327+00:00 app[web.1]:
2014-04-17T18:18:41.209334+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T18:18:41.209336+00:00 app[web.1]: > node app.js
2014-04-17T18:18:41.209466+00:00 app[web.1]:
2014-04-17T18:18:41.831107+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T18:18:41.863975+00:00 app[web.1]: Database connection error, fcukkk: [Error: failed to connect to [localhost:27017]]
2014-04-17T18:18:41.859394+00:00 app[web.1]: Express server listening on port 56521
2014-04-17T18:18:41.983113+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T18:19:12.750685+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=b7e7cab0-e79f-4457-9e5d-1acbfd494ef0 fwd="68.99.126.105" dyno=web.1 connect=5ms service=30001ms status=503 bytes=0
2014-04-17T18:19:12.754834+00:00 app[web.1]: GET / 200 29995ms
2014-04-17T19:21:21.596778+00:00 heroku[web.1]: Idling
2014-04-17T19:21:21.597514+00:00 heroku[web.1]: State changed from up to down
2014-04-17T19:21:26.046285+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-17T19:21:28.181093+00:00 heroku[web.1]: Process exited with status 143
2014-04-17T20:56:21.949618+00:00 heroku[web.1]: Unidling
2014-04-17T20:56:21.949987+00:00 heroku[web.1]: State changed from down to starting
2014-04-17T20:56:31.657944+00:00 heroku[web.1]: Starting process with command `npm start`
2014-04-17T20:56:33.655866+00:00 app[web.1]:
2014-04-17T20:56:33.655871+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T20:56:33.655873+00:00 app[web.1]: > node app.js
2014-04-17T20:56:33.655875+00:00 app[web.1]:
2014-04-17T20:56:34.682567+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T20:56:34.706650+00:00 app[web.1]: Database connection error, fcukkk: [Error: failed to connect to [localhost:27017]]
2014-04-17T20:56:34.703013+00:00 app[web.1]: Express server listening on port 21923
2014-04-17T20:56:35.308394+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T20:57:08.004131+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=033a5a44-68a3-4b1c-8f6c-5755371d076d fwd="68.99.126.105" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
2014-04-17T20:57:08.005107+00:00 app[web.1]: GET / 200 29992ms
2014-04-17T21:17:36.623084+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=1117b0b1-da9d-4fef-ad79-f1a5c4178807 fwd="68.99.126.105" dyno=web.1 connect=2ms service=30000ms status=503 bytes=0
2014-04-17T21:17:36.625513+00:00 app[web.1]: GET / 200 30000ms
2014-04-17T22:07:00.807923+00:00 heroku[web.1]: Idling
2014-04-17T22:07:00.809134+00:00 heroku[web.1]: State changed from up to down
2014-04-17T22:07:04.732639+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-17T22:07:07.514765+00:00 heroku[web.1]: Process exited with status 143
2014-04-17T22:32:27+00:00 heroku[slug-compiler]: Slug compilation started
2014-04-17T22:33:00+00:00 heroku[slug-compiler]: Slug compilation finished
2014-04-17T22:33:00.065665+00:00 heroku[web.1]: State changed from down to starting
2014-04-17T22:32:59.921981+00:00 heroku[api]: Deploy 0e3a24a by marshall.a.x#gmail.com
2014-04-17T22:32:59.922073+00:00 heroku[api]: Release v5 created by marshall.a.x#gmail.com
2014-04-17T22:33:05.771395+00:00 heroku[web.1]: Starting process with command `npm start`
2014-04-17T22:33:07.654364+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T22:33:07.654367+00:00 app[web.1]:
2014-04-17T22:33:07.654366+00:00 app[web.1]: > node app.js
2014-04-17T22:33:07.654359+00:00 app[web.1]:
2014-04-17T22:33:08.435746+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T22:33:08.474993+00:00 app[web.1]: Express server listening on port 20321
2014-04-17T22:33:08.771030+00:00 app[web.1]: sup stud, Database connected.
2014-04-17T22:33:08.770901+00:00 app[web.1]: Succeeded connected to: mongodb://mongodb://heroku_app24230415:l91npmc6qlrdole3ptlq0s8not#ds045157.mongolab.com:45157/heroku_app24230415/images
2014-04-17T22:33:08.577315+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T22:33:48.606992+00:00 app[web.1]: []
2014-04-17T22:33:49.143625+00:00 heroku[router]: at=info method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=982dd016-e68c-4190-a41e-c3a6780a06ef fwd="68.99.126.105" dyno=web.1 connect=2ms service=624ms status=500 bytes=7683
2014-04-17T22:33:49.176065+00:00 app[web.1]: 13| form(method="POST" action="/view/#{image._id}" enctype="multipart/form-data")
2014-04-17T22:33:49.176067+00:00 app[web.1]: 14| input(type="image" src="/images/#{image.source}" name="bigImage" width="300")
2014-04-17T22:33:49.176068+00:00 app[web.1]:
2014-04-17T22:33:49.176060+00:00 app[web.1]: 10| li
2014-04-17T22:33:49.176070+00:00 app[web.1]: Cannot read property 'source' of undefined
2014-04-17T22:33:49.176050+00:00 app[web.1]: TypeError: /app/views/index.jade:11
2014-04-17T22:33:49.176063+00:00 app[web.1]: 12| span
2014-04-17T22:33:49.176062+00:00 app[web.1]: > 11| img(src="/images/#{image.source}" name="original")
2014-04-17T22:33:49.176058+00:00 app[web.1]: 9| each image in images
2014-04-17T22:33:49.176078+00:00 app[web.1]: at res (/app/node_modules/jade/lib/jade.js:173:38)
2014-04-17T22:33:49.176071+00:00 app[web.1]: at eval (eval at <anonymous> (/app/node_modules/jade/lib/jade.js:172:8), <anonymous>:78:56)
2014-04-17T22:33:49.176073+00:00 app[web.1]: at eval (eval at <anonymous> (/app/node_modules/jade/lib/jade.js:172:8), <anonymous>:165:4)
2014-04-17T22:33:49.176075+00:00 app[web.1]: at eval (eval at <anonymous> (/app/node_modules/jade/lib/jade.js:172:8), <anonymous>:184:21)
2014-04-17T22:33:49.176079+00:00 app[web.1]: at Object.exports.render (/app/node_modules/jade/lib/jade.js:269:10)
2014-04-17T22:33:49.176084+00:00 app[web.1]: at View.render (/app/node_modules/express/lib/view.js:76:8)
2014-04-17T22:33:49.176081+00:00 app[web.1]: at Object.exports.renderFile (/app/node_modules/jade/lib/jade.js:305:18)
2014-04-17T22:33:49.176082+00:00 app[web.1]: at View.exports.renderFile [as engine] (/app/node_modules/jade/lib/jade.js:290:21)
2014-04-17T22:33:49.176087+00:00 app[web.1]: at ServerResponse.res.render (/app/node_modules/express/lib/response.js:798:7)
2014-04-17T22:33:49.176085+00:00 app[web.1]: at Function.app.render (/app/node_modules/express/lib/application.js:504:10)
2014-04-17T22:33:49.181859+00:00 app[web.1]: GET / 500 607ms
This is the relevant part of my app.js file:
var uristring= 'mongodb://'+process.env.MONGOLAB_URI+'/images';
var theport = process.env.PORT || 5000;
var appDir = path.dirname(require.main.filename);
mongoose.connect(uristring, function(err,res){
if (err) {
console.log('ERROR connecting to: '+uristring+'. ' + err)
}
else {
console.log('Succeeded connected to: '+uristring);
}
});
var conn = mongoose.connection;
conn.on('error', console.error.bind(console, 'Database connection error, fcukkk:'));
conn.once('open', function callback() {console.log("sup stud, Database connected.")});
I am confused because there is no mention in the docs https://devcenter.heroku.com/articles/nodejs-mongoose of actually creating the database that I am trying to connect to. I assume this is something that mongoose does when you initially connect to the db.

Do you realize that you are connecting successfully at the end of the log? The first 3 times it looked for your DB at localhost:27017, but the 4th time it looked for the proper address (it seems).

Related

I can not deploy my nodejs based app to Heroku

I have created an app that upload some files and than send me object like that
{"name":"MEHMET SAYIN CV - 10_2021.pdf","type":"application/pdf","size":99771}
I used multer to handle uploading files. When I upload it to heroku I failed.I want to share the logs related.
2021-10-15T15:51:02.457409+00:00 app[api]: Deploy 6e984f86 by user sayinmehmet47#gmail.com
2021-10-15T15:51:02.457409+00:00 app[api]: Release v11 created by user sayinmehmet47#gmail.com
2021-10-15T15:51:03.599539+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-15T15:51:05.000000+00:00 app[api]: Build succeeded
2021-10-15T15:51:05.698098+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-15T15:51:06.737506+00:00 app[web.1]:
2021-10-15T15:51:06.737526+00:00 app[web.1]: > file_metadata#0.0.1 start /app
2021-10-15T15:51:06.737527+00:00 app[web.1]: > node server.js
2021-10-15T15:51:06.737527+00:00 app[web.1]:
2021-10-15T15:51:07.036041+00:00 app[web.1]: connected
2021-10-15T15:51:07.068246+00:00 app[web.1]: /app/node_modules/mkdirp/index.js:91
2021-10-15T15:51:07.068247+00:00 app[web.1]: throw err0;
2021-10-15T15:51:07.068248+00:00 app[web.1]: ^
2021-10-15T15:51:07.068248+00:00 app[web.1]:
2021-10-15T15:51:07.068248+00:00 app[web.1]: Error: EROFS: read-only file system, mkdir '/public'
2021-10-15T15:51:07.068249+00:00 app[web.1]: at Object.mkdirSync (fs.js:1013:3)
2021-10-15T15:51:07.068249+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:72:13)
2021-10-15T15:51:07.068250+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T15:51:07.068250+00:00 app[web.1]: at Function.sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T15:51:07.068250+00:00 app[web.1]: at new DiskStorage (/app/node_modules/multer/storage/disk.js:21:12)
2021-10-15T15:51:07.068251+00:00 app[web.1]: at module.exports (/app/node_modules/multer/storage/disk.js:65:10)
2021-10-15T15:51:07.068251+00:00 app[web.1]: at new Multer (/app/node_modules/multer/index.js:15:20)
2021-10-15T15:51:07.068252+00:00 app[web.1]: at multer (/app/node_modules/multer/index.js:95:12)
2021-10-15T15:51:07.068252+00:00 app[web.1]: at Object.<anonymous> (/app/api/files.js:4:16)
2021-10-15T15:51:07.068252+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14) {
2021-10-15T15:51:07.068253+00:00 app[web.1]: errno: -30,
2021-10-15T15:51:07.068253+00:00 app[web.1]: syscall: 'mkdir',
2021-10-15T15:51:07.068253+00:00 app[web.1]: code: 'EROFS',
2021-10-15T15:51:07.068254+00:00 app[web.1]: path: '/public'
2021-10-15T15:51:07.068254+00:00 app[web.1]: }
2021-10-15T15:51:07.079497+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-15T15:51:07.079732+00:00 app[web.1]: npm ERR! errno 1
2021-10-15T15:51:07.083831+00:00 app[web.1]: npm ERR! file_metadata#0.0.1 start: `node server.js`
2021-10-15T15:51:07.083871+00:00 app[web.1]: npm ERR! Exit status 1
2021-10-15T15:51:07.083924+00:00 app[web.1]: npm ERR!
2021-10-15T15:51:07.083988+00:00 app[web.1]: npm ERR! Failed at the file_metadata#0.0.1 start script.
2021-10-15T15:51:07.083989+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-15T15:51:07.089384+00:00 app[web.1]:
2021-10-15T15:51:07.089446+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-15T15:51:07.089472+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-10-15T15_51_07_084Z-debug.log
2021-10-15T15:51:07.196350+00:00 heroku[web.1]: Process exited with status 1
2021-10-15T15:51:07.347289+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-15T15:51:12.784398+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=filedownl12.herokuapp.com request_id=fe098106-1546-4b7c-9b8c-fefe790dfae7 fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T15:51:13.747221+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=filedownl12.herokuapp.com request_id=8173d073-97c1-45e1-afab-c3b2da397e12 fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T16:04:45.000000+00:00 app[api]: Build started by user sayinmehmet47#gmail.com
2021-10-15T16:05:21.465576+00:00 app[api]: Deploy 1f51e389 by user sayinmehmet47#gmail.com
2021-10-15T16:05:21.465576+00:00 app[api]: Release v12 created by user sayinmehmet47#gmail.com
2021-10-15T16:05:23.278268+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-15T16:05:24.000000+00:00 app[api]: Build succeeded
2021-10-15T16:05:26.141343+00:00 heroku[web.1]: Starting process with command `node ./server.js`
2021-10-15T16:05:27.754473+00:00 app[web.1]: connected
2021-10-15T16:05:27.819924+00:00 app[web.1]: /app/node_modules/mkdirp/index.js:91
2021-10-15T16:05:27.819926+00:00 app[web.1]: throw err0;
2021-10-15T16:05:27.819926+00:00 app[web.1]: ^
2021-10-15T16:05:27.819927+00:00 app[web.1]:
2021-10-15T16:05:27.819927+00:00 app[web.1]: Error: EROFS: read-only file system, mkdir '/public'
2021-10-15T16:05:27.819928+00:00 app[web.1]: at Object.mkdirSync (fs.js:1013:3)
2021-10-15T16:05:27.819928+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:72:13)
2021-10-15T16:05:27.819928+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T16:05:27.819929+00:00 app[web.1]: at Function.sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T16:05:27.819929+00:00 app[web.1]: at new DiskStorage (/app/node_modules/multer/storage/disk.js:21:12)
2021-10-15T16:05:27.819930+00:00 app[web.1]: at module.exports (/app/node_modules/multer/storage/disk.js:65:10)
2021-10-15T16:05:27.819930+00:00 app[web.1]: at new Multer (/app/node_modules/multer/index.js:15:20)
2021-10-15T16:05:27.819931+00:00 app[web.1]: at multer (/app/node_modules/multer/index.js:95:12)
2021-10-15T16:05:27.819931+00:00 app[web.1]: at Object.<anonymous> (/app/api/files.js:4:16)
2021-10-15T16:05:27.819931+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14) {
2021-10-15T16:05:27.819932+00:00 app[web.1]: errno: -30,
2021-10-15T16:05:27.819932+00:00 app[web.1]: syscall: 'mkdir',
2021-10-15T16:05:27.819932+00:00 app[web.1]: code: 'EROFS',
2021-10-15T16:05:27.819933+00:00 app[web.1]: path: '/public'
2021-10-15T16:05:27.819933+00:00 app[web.1]: }
2021-10-15T16:05:27.968565+00:00 heroku[web.1]: Process exited with status 1
2021-10-15T16:05:28.098649+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-15T16:05:28.136896+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-15T16:05:30.375434+00:00 heroku[web.1]: Starting process with command `node ./server.js`
2021-10-15T16:05:32.063799+00:00 app[web.1]: connected
2021-10-15T16:05:32.108031+00:00 app[web.1]: /app/node_modules/mkdirp/index.js:91
2021-10-15T16:05:32.108033+00:00 app[web.1]: throw err0;
2021-10-15T16:05:32.108033+00:00 app[web.1]: ^
2021-10-15T16:05:32.108033+00:00 app[web.1]:
2021-10-15T16:05:32.108034+00:00 app[web.1]: Error: EROFS: read-only file system, mkdir '/public'
2021-10-15T16:05:32.108034+00:00 app[web.1]: at Object.mkdirSync (fs.js:1013:3)
2021-10-15T16:05:32.108035+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:72:13)
2021-10-15T16:05:32.108035+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T16:05:32.108035+00:00 app[web.1]: at Function.sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T16:05:32.108036+00:00 app[web.1]: at new DiskStorage (/app/node_modules/multer/storage/disk.js:21:12)
2021-10-15T16:05:32.108036+00:00 app[web.1]: at module.exports (/app/node_modules/multer/storage/disk.js:65:10)
2021-10-15T16:05:32.108036+00:00 app[web.1]: at new Multer (/app/node_modules/multer/index.js:15:20)
2021-10-15T16:05:32.108037+00:00 app[web.1]: at multer (/app/node_modules/multer/index.js:95:12)
2021-10-15T16:05:32.108037+00:00 app[web.1]: at Object.<anonymous> (/app/api/files.js:4:16)
2021-10-15T16:05:32.108037+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14) {
2021-10-15T16:05:32.108038+00:00 app[web.1]: errno: -30,
2021-10-15T16:05:32.108041+00:00 app[web.1]: syscall: 'mkdir',
2021-10-15T16:05:32.108041+00:00 app[web.1]: code: 'EROFS',
2021-10-15T16:05:32.108041+00:00 app[web.1]: path: '/public'
2021-10-15T16:05:32.108041+00:00 app[web.1]: }
2021-10-15T16:05:32.267952+00:00 heroku[web.1]: Process exited with status 1
2021-10-15T16:05:32.695933+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-15T16:05:33.707024+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=filedownl12.herokuapp.com request_id=c9fdfd08-1b36-450e-a4de-fb65785677a4 fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T16:05:34.925481+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=filedownl12.herokuapp.com request_id=3aca34c2-47e0-4f99-9884-13b91ed25f99 fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T16:13:09.486503+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=filedownl12.herokuapp.com request_id=e41ba396-2172-4804-a573-0fafc1a2c47b fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T16:13:10.694600+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=filedownl12.herokuapp.com request_id=4ef46b32-012c-43b2-8342-0a0637d5a29b fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
I also tried to be sure if I set the variables for MONGO_URI,I also set them. Also I created a procfile and write inside it
web: node ./server.js
But it didnt works. I lastly want to share my directories picture.

How to solve not found error in heroku after deployment

I'm tried to upload a MERN stack project on heroku, when I push my project then does not show me any error, but after that when I tried to open my app then show me error like this:
Then when I see on heroku logs show me error like this:
2021-04-02T04:39:53.640765+00:00 app[web.1]: }
2021-04-02T04:39:53.673306+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-04-02T04:39:53.673901+00:00 app[web.1]: npm ERR! errno 1
2021-04-02T04:39:53.688128+00:00 app[web.1]: npm ERR! react-boiler-plate#1.0.0 start: `node server/index.js`
2021-04-02T04:39:53.688366+00:00 app[web.1]: npm ERR! Exit status 1
2021-04-02T04:39:53.688645+00:00 app[web.1]: npm ERR!
2021-04-02T04:39:53.688864+00:00 app[web.1]: npm ERR! Failed at the react-boiler-plate#1.0.0 start script.
2021-04-02T04:39:53.689072+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-04-02T04:39:53.702373+00:00 app[web.1]:
2021-04-02T04:39:53.702750+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-04-02T04:39:53.702956+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-04-02T04_39_53_691Z-debug.log
2021-04-02T04:39:53.801523+00:00 heroku[web.1]: Process exited with status 1
2021-04-02T04:39:57.606025+00:00 app[web.1]:
2021-04-02T04:39:57.606043+00:00 app[web.1]: > react-boiler-plate#1.0.0 start /app
2021-04-02T04:39:57.606044+00:00 app[web.1]: > node server/index.js
2021-04-02T04:39:57.606044+00:00 app[web.1]:
2021-04-02T04:39:59.617643+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2021-04-02T04:39:59.617704+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-04-02T04:39:59.618588+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2021-04-02T04:39:59.618717+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2021-04-02T04:39:59.618853+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2021-04-02T04:39:59.619452+00:00 app[web.1]: Server Listening on 52400
2021-04-02T04:39:59.664202+00:00 heroku[web.1]: State changed from starting to up
2021-04-02T04:40:00.154607+00:00 app[web.1]: MongoDB Connected...
2021-04-02T04:40:02.562719+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=482fc0ad-4dbf-4d68-a0b8-4ad915f0356d fwd="116.58.200.211" dyno=web.1 connect=0ms service=81ms status=404 bytes=412 protocol=https
2021-04-02T04:40:02.564414+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:40:12.580732+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=0cb0a90a-eefe-4730-97f2-58ad7601fb31 fwd="116.58.200.211" dyno=web.1 connect=0ms service=11ms status=404 bytes=412 protocol=https
2021-04-02T04:40:12.581974+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:41:07.703010+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=5195792b-17a0-4044-82a6-8e392f3bc920 fwd="116.58.200.211" dyno=web.1 connect=0ms service=13ms status=404 bytes=412 protocol=https
2021-04-02T04:41:07.703565+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:43:56.612829+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:43:56.614507+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=24d996e4-a43f-427c-89d5-a83fad29ec8e fwd="116.58.200.211" dyno=web.1 connect=2ms service=15ms status=404 bytes=412 protocol=https
2021-04-02T04:47:24.095734+00:00 app[api]: Set NODE_ENV config vars by user alaminsheikh30025#gmail.com
2021-04-02T04:47:24.095734+00:00 app[api]: Release v7 created by user alaminsheikh30025#gmail.com
2021-04-02T04:47:24.300332+00:00 heroku[web.1]: Restarting
2021-04-02T04:47:24.302570+00:00 heroku[web.1]: State changed from up to starting
2021-04-02T04:47:26.081387+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-04-02T04:47:26.273408+00:00 heroku[web.1]: Process exited with status 143
2021-04-02T04:47:28.480334+00:00 heroku[web.1]: Starting process with command `npm start`
2021-04-02T04:47:32.050957+00:00 app[web.1]:
2021-04-02T04:47:32.050999+00:00 app[web.1]: > react-boiler-plate#1.0.0 start /app
2021-04-02T04:47:32.051000+00:00 app[web.1]: > node server/index.js
2021-04-02T04:47:32.051001+00:00 app[web.1]:
2021-04-02T04:47:33.084385+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2021-04-02T04:47:33.084397+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-04-02T04:47:33.085117+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2021-04-02T04:47:33.085232+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2021-04-02T04:47:33.085334+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2021-04-02T04:47:33.085964+00:00 app[web.1]: Server Listening on 8465
2021-04-02T04:47:33.331113+00:00 app[web.1]: MongoDB Connected...
2021-04-02T04:47:33.388190+00:00 heroku[web.1]: State changed from starting to up
2021-04-02T04:47:34.346673+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=183fcfe3-db55-4a00-b385-9d7d66f60ed4 fwd="116.58.200.211" dyno=web.1 connect=1ms service=24ms status=404 bytes=412 protocol=https
2021-04-02T04:47:34.348398+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:48:45.968962+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=2a1df37e-9697-4cf4-be41-cc907f6cb724 fwd="116.58.200.211" dyno=web.1 connect=0ms service=16ms status=404 bytes=412 protocol=https
2021-04-02T04:48:45.969496+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:55:29.405371+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:55:29.405889+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=b9b8b037-8c4a-4c58-9fc9-d116af2283e9 fwd="116.58.200.211" dyno=web.1 connect=0ms service=10ms status=404 bytes=412 protocol=https
2021-04-02T05:02:01.000000+00:00 app[api]: Build started by user alaminsheikh30025#gmail.com
2021-04-02T05:02:35.128829+00:00 app[api]: Deploy 7dd2269f by user alaminsheikh30025#gmail.com
2021-04-02T05:02:35.128829+00:00 app[api]: Release v8 created by user alaminsheikh30025#gmail.com
2021-04-02T05:02:35.313075+00:00 heroku[web.1]: Restarting
2021-04-02T05:02:35.315983+00:00 heroku[web.1]: State changed from up to starting
2021-04-02T05:02:36.000000+00:00 app[api]: Build succeeded
2021-04-02T05:02:36.713360+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-04-02T05:02:36.983404+00:00 heroku[web.1]: Process exited with status 143
2021-04-02T05:02:39.085257+00:00 heroku[web.1]: Starting process with command `npm start`
2021-04-02T05:02:42.325482+00:00 app[web.1]:
2021-04-02T05:02:42.326048+00:00 app[web.1]: > react-boiler-plate#1.0.0 start /app
2021-04-02T05:02:42.326051+00:00 app[web.1]: > node server/index.js
2021-04-02T05:02:42.326053+00:00 app[web.1]:
2021-04-02T05:02:43.565518+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2021-04-02T05:02:43.565529+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-04-02T05:02:43.566549+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2021-04-02T05:02:43.566660+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2021-04-02T05:02:43.566774+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2021-04-02T05:02:43.567285+00:00 app[web.1]: Server Listening on 58335
2021-04-02T05:02:43.757613+00:00 app[web.1]: MongoDB Connected...
2021-04-02T05:02:43.923407+00:00 heroku[web.1]: State changed from starting to up
2021-04-02T05:03:06.224704+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=0dfe3e56-29e2-4abd-9326-30f22a3f3a3f fwd="116.58.200.211" dyno=web.1 connect=3ms service=24ms status=404 bytes=412 protocol=https
2021-04-02T05:03:06.226724+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T05:37:05.548583+00:00 heroku[web.1]: Idling
2021-04-02T05:37:05.550224+00:00 heroku[web.1]: State changed from up to down
2021-04-02T05:37:06.905027+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-04-02T05:37:07.188301+00:00 heroku[web.1]: Process exited with status 143
2021-04-02T05:45:52.000000+00:00 app[api]: Build started by user alaminsheikh30025#gmail.com
2021-04-02T05:46:24.941298+00:00 app[api]: Deploy 3d2e9eec by user alaminsheikh30025#gmail.com
2021-04-02T05:46:24.941298+00:00 app[api]: Release v9 created by user alaminsheikh30025#gmail.com
2021-04-02T05:46:25.895329+00:00 heroku[web.1]: State changed from down to starting
2021-04-02T05:46:26.000000+00:00 app[api]: Build succeeded
2021-04-02T05:46:29.859262+00:00 heroku[web.1]: Starting process with command `node index.js`
2021-04-02T05:46:33.688119+00:00 app[web.1]: (node:4) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2021-04-02T05:46:33.688136+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-04-02T05:46:33.688805+00:00 app[web.1]: (node:4) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2021-04-02T05:46:33.688950+00:00 app[web.1]: (node:4) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2021-04-02T05:46:33.689117+00:00 app[web.1]: (node:4) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2021-04-02T05:46:33.689750+00:00 app[web.1]: Server Listening on 3542
2021-04-02T05:46:33.946525+00:00 app[web.1]: MongoDB Connected...
2021-04-02T05:46:34.274995+00:00 heroku[web.1]: State changed from starting to up
2021-04-02T05:46:41.770270+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=c42834c5-a16c-4c12-ab34-41f2a229d0d6 fwd="116.58.200.211" dyno=web.1 connect=0ms service=48ms status=404 bytes=412 protocol=https
2021-04-02T05:46:41.775861+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
I have config file by this way:
.dev.js file:
module.exports = {
mongoURI:
"mongodb+srv://username:pass#demo.erwyk.mongodb.net/PORTFOLIO?retryWrites=true&w=majority",
};
prod.js file:
module.exports = {
mongoURI: process.env.MONGO_URI,
};
key.js file:
if (process.env.NODE_ENV === 'production') {
module.exports = require('./prod');
} else {
module.exports = require('./dev');
}
then I have add config file on heroku:
Any Suggestion Please.
Actually I was problem on project config, I have solved by this way:
Make configuration for heroku deployment
specify npm and node version for frontend deployment.[check version npm -v and node -v]
Then npm run build for client folder
Put environment variable for production mode in heroku website [for me MONGO_URI]
then go to server folder inside package.js
add this line of code
script {
....
"heroku-postbuild": "NPM_PRODUCTION:false npm install --prefix client && npm run build --prefix client"
}
That's it.
then go to terminal...
heroku login
git init
git add .
git commit -m "bug fixed"
heroku git:remote -a <app_name> (if already created a app in heroku, otherwise heroku create)
git push heroku master
heroku open
Hope app will run successfully,
Thank you, [if still faced any problem then let me know in the comment section]

Trouble Deploying a Website/Web App on Heroku

I am trying to deploy a web app on Heroku and it keeps crashing.
After checking the logs, it says it crashed right before starting process with command 'node app.js'
After pushing my app to Heroku Git, I clicked on the link and it gave me a missing script: start.
I added "start": "index.js" to my scripts, replacing the test and return 1 string.
Now, I'm getting a different application error.
Here are the logs:
2019-04-16T15:55:19.291517+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-04-16T15_55_19_283Z-debug.log
2019-04-16T15:55:22.076257+00:00 heroku[web.1]: Starting process with command `npm start`
2019-04-16T15:55:24.008573+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T15:55:24.034855+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T15:55:23.952515+00:00 app[web.1]: npm ERR! missing script: start
2019-04-16T15:55:23.958426+00:00 app[web.1]:
2019-04-16T15:55:23.958664+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-04-16T15:55:23.958754+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-04-16T15_55_23_953Z-debug.log
2019-04-16T16:19:04.974643+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T16:19:08.471350+00:00 heroku[web.1]: Starting process with command `npm start`
2019-04-16T16:19:10.946953+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T16:19:10.920954+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T16:19:10.847576+00:00 app[web.1]: npm ERR! missing script: start
2019-04-16T16:19:10.856940+00:00 app[web.1]:
2019-04-16T16:19:10.862276+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-04-16T16:19:10.862279+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-04-16T16_19_10_849Z-debug.log
2019-04-16T16:21:52.000000+00:00 app[api]: Build started by user bsautry#ualr.edu
2019-04-16T16:22:14.048093+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T16:22:13.644927+00:00 app[api]: Release v4 created by user bsautry#ualr.edu
2019-04-16T16:22:13.644927+00:00 app[api]: Deploy 69b62110 by user bsautry#ualr.edu
2019-04-16T16:22:17.615771+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T16:22:18.000000+00:00 app[api]: Build succeeded
2019-04-16T16:22:20.049173+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T16:22:20.067122+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T16:22:19.975525+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T16:22:19.975544+00:00 app[web.1]: throw err;
2019-04-16T16:22:19.975546+00:00 app[web.1]: ^
2019-04-16T16:22:19.975548+00:00 app[web.1]:
2019-04-16T16:22:19.975549+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T16:22:19.975551+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T16:22:19.975553+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T16:22:19.975555+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T16:22:19.975557+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T16:22:19.975559+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T16:25:54.162474+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=loveplumbing.herokuapp.com request_id=589c1650-a614-4aae-a8e5-ffb58a523e1e fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T16:25:54.759301+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=loveplumbing.herokuapp.com request_id=3c7f8d06-e415-48ae-952d-3968d12db75c fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T16:30:55.410784+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T16:30:58.687945+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T16:31:01.064389+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T16:31:00.983841+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T16:31:00.983863+00:00 app[web.1]: throw err;
2019-04-16T16:31:00.983865+00:00 app[web.1]: ^
2019-04-16T16:31:00.983866+00:00 app[web.1]:
2019-04-16T16:31:00.983868+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T16:31:00.983870+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T16:31:00.983872+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T16:31:00.983873+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T16:31:00.983874+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T16:31:00.983875+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T16:31:01.040784+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T16:59:14.705641+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T16:59:18.023601+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T16:59:20.925080+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T16:59:20.905853+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T16:59:20.804107+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T16:59:20.804145+00:00 app[web.1]: throw err;
2019-04-16T16:59:20.804147+00:00 app[web.1]: ^
2019-04-16T16:59:20.804149+00:00 app[web.1]:
2019-04-16T16:59:20.804150+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T16:59:20.804153+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T16:59:20.804155+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T16:59:20.804156+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T16:59:20.804158+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T16:59:20.804159+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T17:37:18.987655+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=loveplumbing.herokuapp.com request_id=1fc71b49-e1f4-4e23-b898-9d77035b5e04 fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:37:19.514237+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=loveplumbing.herokuapp.com request_id=a9886709-5ec0-49da-adfd-0c02d8378903 fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:45:46.000000+00:00 app[api]: Build started by user bsautry#ualr.edu
2019-04-16T17:46:08.863208+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T17:46:08.459037+00:00 app[api]: Release v5 created by user bsautry#ualr.edu
2019-04-16T17:46:08.459037+00:00 app[api]: Deploy 9cfd1de3 by user bsautry#ualr.edu
2019-04-16T17:46:12.241604+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T17:46:13.000000+00:00 app[api]: Build succeeded
2019-04-16T17:46:14.898819+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T17:46:14.914929+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T17:46:14.882816+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T17:46:14.816039+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T17:46:14.816072+00:00 app[web.1]: throw err;
2019-04-16T17:46:14.816074+00:00 app[web.1]: ^
2019-04-16T17:46:14.816076+00:00 app[web.1]:
2019-04-16T17:46:14.816078+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T17:46:14.816080+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T17:46:14.816081+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T17:46:14.816083+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T17:46:14.816084+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T17:46:14.816086+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T17:46:19.195129+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T17:46:22.064061+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T17:46:22.040652+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T17:46:21.962948+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T17:46:21.962978+00:00 app[web.1]: throw err;
2019-04-16T17:46:21.962980+00:00 app[web.1]: ^
2019-04-16T17:46:21.962981+00:00 app[web.1]:
2019-04-16T17:46:21.962983+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T17:46:21.962985+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T17:46:21.962987+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T17:46:21.962989+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T17:46:21.962991+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T17:46:21.962992+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T17:46:22.320545+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=loveplumbing.herokuapp.com request_id=a8e86470-1fee-4159-a683-a4437e46ccbc fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:46:23.689417+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=loveplumbing.herokuapp.com request_id=a7e1403a-3ee9-490f-9446-b4d8150761ee fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:49:56.610263+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=loveplumbing.herokuapp.com request_id=fac4cd8f-dfce-4023-bc1d-e27e3297cd59 fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:49:57.055698+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=loveplumbing.herokuapp.com request_id=b431c26e-62c1-42ca-908d-bbe70be171e4 fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
I expect it will be some sort of file naming issue.
Well, according to your error messages
Error: Cannot find module '/app/app.js'
I believe it is trying to find your app.js which is I guess it should be your index.js. What exactly are you using? Angular? If so, check this link as it helped me to understand how to set up an angular project to deploy to heroku.
https://medium.com/#hellotunmbi/how-to-deploy-angular-application-to-heroku-1d56e09c5147

Heroku app not working on remote

I am deploying a simple node.js application. It seems to run fine locally (I see all the functionality I have written so far), but when I run:
heroku open cool
I just see a blank page.
Here are my logs:
2016-03-28T19:03:04.567334+00:00 heroku[web.1]: Idling
2016-03-28T19:03:04.568049+00:00 heroku[web.1]: State changed from up to down
2016-03-28T19:03:09.551701+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-03-28T19:03:11.228745+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2016-03-28T19:03:12.390081+00:00 heroku[web.1]: Process exited with status 22
2016-03-28T21:08:49.503946+00:00 heroku[web.1]: Unidling
2016-03-28T21:08:49.504269+00:00 heroku[web.1]: State changed from down to starting
2016-03-28T21:08:51.391775+00:00 heroku[web.1]: Starting process with command `npm start`
2016-03-28T21:08:56.437135+00:00 app[web.1]:
2016-03-28T21:08:56.437149+00:00 app[web.1]: > transloc#1.0.0 start /app
2016-03-28T21:08:56.437150+00:00 app[web.1]: > node server.js
2016-03-28T21:08:56.437151+00:00 app[web.1]:
2016-03-28T21:08:57.152952+00:00 heroku[web.1]: State changed from starting to up
2016-03-28T21:08:58.586930+00:00 heroku[router]: at=info method=GET path="/cool" host=still-depths-35391.herokuapp.com request_id=6feab52c-143c-4353-bbbc-696355042cbc fwd="152.3.43.142" dyno=web.1 connect=1ms service=25ms status=200 bytes=1764
2016-03-28T21:08:58.910098+00:00 heroku[router]: at=info method=GET path="/server.js" host=still-depths-35391.herokuapp.com request_id=5c3ab4d4-0a5d-48fa-b272-7c82000da3dd fwd="152.3.43.142" dyno=web.1 connect=1ms service=7ms status=200 bytes=1764
2016-03-28T21:08:58.960943+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=still-depths-35391.herokuapp.com request_id=e7a35c05-da23-4a47-995e-98f015ea08ed fwd="152.3.43.142" dyno=web.1 connect=5ms service=7ms status=200 bytes=1764

what does error status 413 in node.js, heroku mean?

I have a node.js app that works fine locally but when i run in at heroku it quits, I status 0 or status 143 does anyone understand what this can mean?
2015-04-14T21:14:41.428508+00:00 heroku[api]: Release v8 created by
josef#actionist.se
2015-04-14T21:14:41.569626+00:00 heroku[web.1]: State changed from up to starting
2015-04-14T21:14:44.101446+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-04-14T21:14:45.789499+00:00 heroku[web.1]: Starting process with command `node index.js`
2015-04-14T21:14:45.675609+00:00 heroku[web.1]: Process exited with status 143
2015-04-14T21:14:47.559184+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-04-14T21:14:47.559208+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-04-14T21:14:49.398042+00:00 app[web.1]: Node app is running at localhost:26268
2015-04-14T21:14:49.825551+00:00 heroku[web.1]: State changed from starting to up
2015-04-14T21:16:05.765151+00:00 heroku[api]: Deploy bcb1918 by josef#actionist.se
2015-04-14T21:16:05.765151+00:00 heroku[api]: Release v9 created by josef#actionist.se
2015-04-14T21:16:06.234464+00:00 heroku[web.1]: State changed from up to starting
2015-04-14T21:16:09.804498+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-04-14T21:16:10.788591+00:00 heroku[web.1]: Starting process with command `npm start`
2015-04-14T21:16:11.515039+00:00 heroku[web.1]: Process exited with status 143
2015-04-14T21:16:12.732654+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-04-14T21:16:12.732736+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-04-14T21:16:13.951425+00:00 app[web.1]:
2015-04-14T21:16:13.951416+00:00 app[web.1]:
2015-04-14T21:16:13.951422+00:00 app[web.1]: > party#0.1.3 start /app
2015-04-14T21:16:13.951424+00:00 app[web.1]: > node app.js
2015-04-14T21:16:15.479452+00:00 heroku[web.1]: Process exited with status 0
2015-04-14T21:16:15.494024+00:00 heroku[web.1]: State changed from starting to crashed
2015-04-14T21:17:13.883207+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/host=actionistcookalong.herokuapp.com request_id=a5f2ce21-21bd-43ac-8434-9eb39282c542 fwd="178.78.232.172" dyno= connect= service= status=503 bytes=
2015-04-14T21:21:01.044982+00:00 heroku[web.1]: State changed from crashed to starting
2015-04-14T21:21:05.040510+00:00 heroku[web.1]: Starting process with command `npm start`
2015-04-14T21:21:06.954809+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-04-14T21:21:06.954834+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-04-14T21:21:07.605924+00:00 app[web.1]:
2015-04-14T21:21:07.605931+00:00 app[web.1]: > party#0.1.3 start /app
2015-04-14T21:21:07.605933+00:00 app[web.1]: > node app.js
2015-04-14T21:21:07.605935+00:00 app[web.1]:
2015-04-14T21:21:08.874268+00:00 heroku[web.1]: State changed from starting to crashed
2015-04-14T21:21:08.868440+00:00 heroku[web.1]: Process exited with status 0
An exit code of 143 means that a kill process was sent and a SIGTERM signal terminated your process. This is usually triggered whenever you execute any restart commands.
Try running the console, it might crash as well... but will give you the reasoning. Usually it will be some small change you hadn't noticed or forgotten about that the Heroku error logs are bad at reporting.
run this
heroku run node
or
heroku restart

Categories

Resources