This is the error it gives me when I deploy to heroku
It is says that I should check the file "localScrape.js" on line 11 column 21.
I went and included a try/catch block to work my way around it but it is persistently giving me the same error could.
2020-10-02T14:06:40.613205+00:00 app[web.1]: > node index
2020-10-02T14:06:40.613205+00:00 app[web.1]:
2020-10-02T14:06:41.196275+00:00 app[web.1]: Innitializing.....
2020-10-02T14:06:41.197532+00:00 app[web.1]: Starting the server....
2020-10-02T14:06:41.197609+00:00 app[web.1]: Server started..
2020-10-02T14:06:41.197667+00:00 app[web.1]: Server Listening on port 4000
2020-10-02T14:06:41.950485+00:00 app[web.1]: DB Connected successfully
2020-10-02T14:06:47.624092+00:00 app[web.1]: events.js:292
2020-10-02T14:06:47.624104+00:00 app[web.1]: throw er; // Unhandled 'error' event
2020-10-02T14:06:47.624105+00:00 app[web.1]: ^
2020-10-02T14:06:47.624105+00:00 app[web.1]:
2020-10-02T14:06:47.624106+00:00 app[web.1]: Error: read ENOTCONN
2020-10-02T14:06:47.624106+00:00 app[web.1]: at tryReadStart (net.js:573:20)
2020-10-02T14:06:47.624107+00:00 app[web.1]: at Socket._read (net.js:584:5)
2020-10-02T14:06:47.624107+00:00 app[web.1]: at Socket.Readable.read (_stream_readable.js:467:10)
2020-10-02T14:06:47.624108+00:00 app[web.1]: at Socket.read (net.js:624:39)
2020-10-02T14:06:47.624108+00:00 app[web.1]: at new Socket (net.js:376:12)
2020-10-02T14:06:47.624109+00:00 app[web.1]: at Object.Socket (net.js:267:41)
2020-10-02T14:06:47.624109+00:00 app[web.1]: at createSocket (internal/child_process.js:314:14)
2020-10-02T14:06:47.624109+00:00 app[web.1]: at ChildProcess.spawn (internal/child_process.js:437:23)
2020-10-02T14:06:47.624110+00:00 app[web.1]: at Object.spawn (child_process.js:548:9)
2020-10-02T14:06:47.624110+00:00 app[web.1]: at BrowserRunner.start (/app/node_modules/puppeteer/lib/launcher/BrowserRunner.js:51:34)
2020-10-02T14:06:47.624111+00:00 app[web.1]: at ChromeLauncher.launch (/app/node_modules/puppeteer/lib/Launcher.js:64:16)
2020-10-02T14:06:47.624111+00:00 app[web.1]: at async localScrape (/app/Scraper/localScrape.js:11:21)
2020-10-02T14:06:47.624111+00:00 app[web.1]: at async doScraping (/app/index.js:20:3)
2020-10-02T14:06:47.624112+00:00 app[web.1]: Emitted 'error' event on Socket instance at:
2020-10-02T14:06:47.624112+00:00 app[web.1]: at emitErrorNT (internal/streams/destroy.js:92:8)
2020-10-02T14:06:47.624112+00:00 app[web.1]: at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
2020-10-02T14:06:47.624113+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:84:21) {
2020-10-02T14:06:47.624113+00:00 app[web.1]: errno: 'ENOTCONN',
2020-10-02T14:06:47.624114+00:00 app[web.1]: code: 'ENOTCONN',
2020-10-02T14:06:47.624114+00:00 app[web.1]: syscall: 'read'
2020-10-02T14:06:47.624114+00:00 app[web.1]: }
2020-10-02T14:06:47.643941+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-10-02T14:06:47.644301+00:00 app[web.1]: npm ERR! errno 1
2020-10-02T14:06:47.648553+00:00 app[web.1]: npm ERR! scraping-script-for-news#1.0.0 start: `node index`
2020-10-02T14:06:47.648770+00:00 app[web.1]: npm ERR! Exit status 1
2020-10-02T14:06:47.649014+00:00 app[web.1]: npm ERR!
2020-10-02T14:06:47.649222+00:00 app[web.1]: npm ERR! Failed at the scraping-script-for-news#1.0.0 start script.
2020-10-02T14:06:47.649428+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-10-02T14:06:49.194170+00:00 app[web.1]:
2020-10-02T14:06:49.194363+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-10-02T14:06:49.194480+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-10-02T14_06_47_651Z-debug.log
2020-10-02T14:06:49.249822+00:00 heroku[web.1]: Process exited with status 1
2020-10-02T14:06:49.281443+00:00 heroku[web.1]: State changed from starting to crashed```
Related
I have this project working locally and it seems to be interacting with the mLab database on heroku when I save information through my localhost. However, when I use the heroku link, I get an application error which tells me to take a look at the logs. I posted a picture of the full log below.
Here is a link to the repo:https://github.com/TheGreekCuban/ButterflySocial
Heroku deployed link: https://butterflysocial.herokuapp.com/
I've tried deleting package-lock.json and node modules, I've made sure my config variables match up, I've read all similar material on the internet and still can't figure it out. I think it has to do with either:
The build process
The mlab connection
See error messages below.
I expect the app to run as it does locally. The error messages when I write heroku logs --tail are:
2019-10-10T06:50:37.277769+00:00 app[web.1]: at Connection.emit (events.js:198:13)
2019-10-10T06:50:37.277771+00:00 app[web.1]: at processMessage (/app/node_modules/mongodb/lib/core/connection/connection.js:364:10)
2019-10-10T06:50:37.277773+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongodb/lib/core/connection/connection.js:533:15)
2019-10-10T06:50:37.277776+00:00 app[web.1]: at Socket.emit (events.js:198:13)
2019-10-10T06:50:37.277778+00:00 app[web.1]: at addChunk (_stream_readable.js:288:12)
2019-10-10T06:50:37.27778+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:269:11)
2019-10-10T06:50:37.277782+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:224:10)
2019-10-10T06:50:37.277784+00:00 app[web.1]: at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
2019-10-10T06:50:37.291411+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-10-10T06:50:37.292117+00:00 app[web.1]: npm ERR! errno 1
2019-10-10T06:50:37.293986+00:00 app[web.1]: npm ERR! mern#1.0.0 start:prod: `node server.js`
2019-10-10T06:50:37.294229+00:00 app[web.1]: npm ERR! Exit status 1
2019-10-10T06:50:37.294617+00:00 app[web.1]: npm ERR!
2019-10-10T06:50:37.29488+00:00 app[web.1]: npm ERR! Failed at the mern#1.0.0 start:prod script.
2019-10-10T06:50:37.29508+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-10-10T06:50:37.302171+00:00 app[web.1]:
2019-10-10T06:50:37.302456+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-10-10T06:50:37.30261+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-10-10T06_50_37_297Z-debug.log
2019-10-10T06:50:37.75424+00:00 app[web.1]:
2019-10-10T06:50:37.754257+00:00 app[web.1]: > mern#1.0.0 start:dev /app
2019-10-10T06:50:37.754259+00:00 app[web.1]: > concurrently "nodemon --ignore 'client/*'" "npm run client"
2019-10-10T06:50:37.754261+00:00 app[web.1]:
2019-10-10T06:50:37.760003+00:00 app[web.1]: sh: 1: concurrently: not found
2019-10-10T06:50:37.765837+00:00 app[web.1]: npm ERR! file sh
2019-10-10T06:50:37.766059+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-10-10T06:50:37.766219+00:00 app[web.1]: npm ERR! errno ENOENT
2019-10-10T06:50:37.766365+00:00 app[web.1]: npm ERR! syscall spawn
2019-10-10T06:50:37.76744+00:00 app[web.1]: npm ERR! mern#1.0.0 start:dev: `concurrently "nodemon --ignore 'client/*'" "npm run client"`
2019-10-10T06:50:37.767549+00:00 app[web.1]: npm ERR! spawn ENOENT
2019-10-10T06:50:37.767758+00:00 app[web.1]: npm ERR!
2019-10-10T06:50:37.767881+00:00 app[web.1]: npm ERR! Failed at the mern#1.0.0 start:dev script.
2019-10-10T06:50:37.768053+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-10-10T06:50:37.772518+00:00 app[web.1]:
2019-10-10T06:50:37.772726+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-10-10T06:50:37.772869+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-10-10T06_50_37_769Z-debug.log
2019-10-10T06:50:37.780063+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-10-10T06:50:37.780556+00:00 app[web.1]: npm ERR! errno 1
2019-10-10T06:50:37.78215+00:00 app[web.1]: npm ERR! mern#1.0.0 start: `if-env NODE_ENV=production && npm run start:prod || npm run start:dev`
2019-10-10T06:50:37.782339+00:00 app[web.1]: npm ERR! Exit status 1
2019-10-10T06:50:37.782696+00:00 app[web.1]: npm ERR!
2019-10-10T06:50:37.782965+00:00 app[web.1]: npm ERR! Failed at the mern#1.0.0 start script.
2019-10-10T06:50:37.783129+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-10-10T06:50:37.788035+00:00 app[web.1]:
2019-10-10T06:50:37.788187+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-10-10T06:50:37.78828+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-10-10T06_50_37_784Z-debug.log
2019-10-10T06:50:37.843017+00:00 heroku[web.1]: Process exited with status 1
2019-10-10T06:50:37.880511+00:00 heroku[web.1]: State changed from up to crashed
2019-10-10T07:01:30.93415+00:00 heroku[web.1]: State changed from crashed to starting
2019-10-10T07:01:47.992091+00:00 heroku[web.1]: Starting process with command `npm start`
2019-10-10T07:01:51.884742+00:00 app[web.1]:
2019-10-10T07:01:51.884761+00:00 app[web.1]: > mern#1.0.0 start /app
2019-10-10T07:01:51.884764+00:00 app[web.1]: > if-env NODE_ENV=production && npm run start:prod || npm run start:dev
2019-10-10T07:01:51.884766+00:00 app[web.1]:
2019-10-10T07:01:52.543917+00:00 app[web.1]:
2019-10-10T07:01:52.543943+00:00 app[web.1]: > mern#1.0.0 start:prod /app
2019-10-10T07:01:52.543946+00:00 app[web.1]: > node server.js
2019-10-10T07:01:52.543948+00:00 app[web.1]:
2019-10-10T07:01:54.038422+00:00 heroku[web.1]: source=web.1 dyno=heroku.149127838.c5e2572d-1b0e-42da-9a10-477a612609fa sample#memory_total=74.10MB sample#memory_rss=74.09MB sample#memory_cache=0.00MB sample#memory_swap=0.00MB sample#memory_pgpgin=19495pages sample#memory_pgpgout=3592pages sample#memory_quota=512.00MB
2019-10-10T07:01:54.299616+00:00 app[web.1]: mongodb://heroku_dvgm3n64:e7q2lkul6l3elf7qp3qbvu69vi#ds333248.mlab.com:33248/heroku_dvgm3n64
2019-10-10T07:01:54.333212+00:00 app[web.1]: does this do stuffs
2019-10-10T07:01:54.341108+00:00 app[web.1]: mongodb://useralex1:Emerson1*#ds333248.mlab.com:33248/heroku_dvgm3n64
2019-10-10T07:01:54.353677+00:00 app[web.1]: (node:42) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
2019-10-10T07:01:54.354266+00:00 app[web.1]: 🌎 ==> API Server now listening on PORT 12283!
2019-10-10T07:01:54.421227+00:00 app[web.1]: /app/node_modules/mongodb/lib/topologies/server.js:240
2019-10-10T07:01:54.42123+00:00 app[web.1]: throw err;
2019-10-10T07:01:54.421233+00:00 app[web.1]: ^
2019-10-10T07:01:54.421235+00:00 app[web.1]:
2019-10-10T07:01:54.421237+00:00 app[web.1]: MongoNetworkError: failed to connect to server [ds333248.mlab.com:33248] on first connect [MongoError: Authentication failed.]
2019-10-10T07:01:54.42124+00:00 app[web.1]: at Pool.<anonymous> (/app/node_modules/mongodb/lib/core/topologies/server.js:431:11)
2019-10-10T07:01:54.421242+00:00 app[web.1]: at Pool.emit (events.js:198:13)
2019-10-10T07:01:54.421244+00:00 app[web.1]: at connect (/app/node_modules/mongodb/lib/core/connection/pool.js:580:14)
2019-10-10T07:01:54.421246+00:00 app[web.1]: at callback (/app/node_modules/mongodb/lib/core/connection/connect.js:109:5)
2019-10-10T07:01:54.421248+00:00 app[web.1]: at provider.auth.err (/app/node_modules/mongodb/lib/core/connection/connect.js:352:21)
2019-10-10T07:01:54.42125+00:00 app[web.1]: at _authenticateSingleConnection (/app/node_modules/mongodb/lib/core/auth/auth_provider.js:66:11)
2019-10-10T07:01:54.421253+00:00 app[web.1]: at sendAuthCommand (/app/node_modules/mongodb/lib/core/auth/scram.js:177:16)
2019-10-10T07:01:54.421255+00:00 app[web.1]: at Connection.messageHandler (/app/node_modules/mongodb/lib/core/connection/connect.js:334:5)
2019-10-10T07:01:54.421257+00:00 app[web.1]: at Connection.emit (events.js:198:13)
2019-10-10T07:01:54.421259+00:00 app[web.1]: at processMessage (/app/node_modules/mongodb/lib/core/connection/connection.js:364:10)
2019-10-10T07:01:54.421261+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongodb/lib/core/connection/connection.js:533:15)
2019-10-10T07:01:54.421263+00:00 app[web.1]: at Socket.emit (events.js:198:13)
2019-10-10T07:01:54.421265+00:00 app[web.1]: at addChunk (_stream_readable.js:288:12)
2019-10-10T07:01:54.421267+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:269:11)
2019-10-10T07:01:54.421269+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:224:10)
2019-10-10T07:01:54.421271+00:00 app[web.1]: at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
2019-10-10T07:01:54.44114+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-10-10T07:01:54.442022+00:00 app[web.1]: npm ERR! errno 1
2019-10-10T07:01:54.444207+00:00 app[web.1]: npm ERR! mern#1.0.0 start:prod: `node server.js`
2019-10-10T07:01:54.444479+00:00 app[web.1]: npm ERR! Exit status 1
2019-10-10T07:01:54.444934+00:00 app[web.1]: npm ERR!
2019-10-10T07:01:54.445255+00:00 app[web.1]: npm ERR! Failed at the mern#1.0.0 start:prod script.
2019-10-10T07:01:54.44552+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-10-10T07:01:54.458793+00:00 app[web.1]:
2019-10-10T07:01:54.459372+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-10-10T07:01:54.459708+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-10-10T07_01_54_447Z-debug.log
2019-10-10T07:01:55.403829+00:00 app[web.1]:
2019-10-10T07:01:55.403851+00:00 app[web.1]: > mern#1.0.0 start:dev /app
2019-10-10T07:01:55.403855+00:00 app[web.1]: > concurrently "nodemon --ignore 'client/*'" "npm run client"
2019-10-10T07:01:55.403857+00:00 app[web.1]:
2019-10-10T07:01:55.465173+00:00 app[web.1]: sh: 1: concurrently: not found
2019-10-10T07:01:55.476951+00:00 app[web.1]: npm ERR! file sh
2019-10-10T20:54:45.636326+00:00 heroku[web.1]: State changed from crashed to starting
2019-10-10T20:54:59.872839+00:00 heroku[web.1]: Starting process with command `npm start`
2019-10-10T20:55:02.396371+00:00 app[web.1]:
2019-10-10T20:55:02.39639+00:00 app[web.1]: > mern#1.0.0 start /app
2019-10-10T20:55:02.396393+00:00 app[web.1]: > if-env NODE_ENV=production && npm run start:prod || npm run start:dev
2019-10-10T20:55:02.396395+00:00 app[web.1]:
2019-10-10T20:55:02.889922+00:00 app[web.1]:
2019-10-10T20:55:02.889946+00:00 app[web.1]: > mern#1.0.0 start:prod /app
2019-10-10T20:55:02.889949+00:00 app[web.1]: > node server.js
2019-10-10T20:55:02.889952+00:00 app[web.1]:
2019-10-10T20:55:03.004906+00:00 app[web.1]: internal/modules/cjs/loader.js:638
2019-10-10T20:55:03.004911+00:00 app[web.1]: throw err;
2019-10-10T20:55:03.004913+00:00 app[web.1]: ^
2019-10-10T20:55:03.004915+00:00 app[web.1]:
2019-10-10T20:55:03.00492+00:00 app[web.1]: Error: Cannot find module 'dotenv'
2019-10-10T20:55:03.004923+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
2019-10-10T20:55:03.004925+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:562:25)
2019-10-10T20:55:03.004927+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:692:17)
2019-10-10T20:55:03.004929+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2019-10-10T20:55:03.004931+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:1:1)
2019-10-10T20:55:03.004933+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:778:30)
2019-10-10T20:55:03.004935+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
2019-10-10T20:55:03.004937+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2019-10-10T20:55:03.004938+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2019-10-10T20:55:03.004943+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2019-10-10T20:55:03.010806+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-10-10T20:55:03.011262+00:00 app[web.1]: npm ERR! errno 1
2019-10-10T20:55:03.012792+00:00 app[web.1]: npm ERR! mern#1.0.0 start:prod: `node server.js`
2019-10-10T20:55:03.012894+00:00 app[web.1]: npm ERR! Exit status 1
2019-10-10T20:55:03.013145+00:00 app[web.1]: npm ERR!
2019-10-10T20:55:03.013407+00:00 app[web.1]: npm ERR! Failed at the mern#1.0.0 start:prod script.
2019-10-10T20:55:03.013617+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-10-10T20:55:03.023551+00:00 app[web.1]:
2019-10-10T20:55:03.023712+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-10-10T20:55:03.023791+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-10-10T20_55_03_015Z-debug.log
2019-10-10T20:55:03.413352+00:00 app[web.1]:
2019-10-10T20:55:03.413367+00:00 app[web.1]: > mern#1.0.0 start:dev /app
2019-10-10T20:55:03.41337+00:00 app[web.1]: > concurrently "nodemon --ignore 'client/*'" "npm run client"
2019-10-10T20:55:03.413372+00:00 app[web.1]:
2019-10-10T20:55:03.418825+00:00 app[web.1]: sh: 1: concurrently: not found
2019-10-10T20:55:03.425842+00:00 app[web.1]: npm ERR! file sh
2019-10-10T20:55:03.426173+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-10-10T20:55:03.426436+00:00 app[web.1]: npm ERR! errno ENOENT
2019-10-10T20:55:03.426736+00:00 app[web.1]: npm ERR! syscall spawn
2019-10-10T20:55:03.428257+00:00 app[web.1]: npm ERR! mern#1.0.0 start:dev: `concurrently "nodemon --ignore 'client/*'" "npm run client"`
2019-10-10T20:55:03.428478+00:00 app[web.1]: npm ERR! spawn ENOENT
2019-10-10T20:55:03.428731+00:00 app[web.1]: npm ERR!
2019-10-10T20:55:03.428905+00:00 app[web.1]: npm ERR! Failed at the mern#1.0.0 start:dev script.
2019-10-10T20:55:03.429153+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-10-10T20:55:03.437512+00:00 app[web.1]:
2019-10-10T20:55:03.437701+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-10-10T20:55:03.437824+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-10-10T20_55_03_430Z-debug.log
2019-10-10T20:55:03.454807+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-10-10T20:55:03.455813+00:00 app[web.1]: npm ERR! errno 1
2019-10-10T20:55:03.457977+00:00 app[web.1]: npm ERR! mern#1.0.0 start: `if-env NODE_ENV=production && npm run start:prod || npm run start:dev`
2019-10-10T20:55:03.458149+00:00 app[web.1]: npm ERR! Exit status 1
2019-10-10T20:55:03.458451+00:00 app[web.1]: npm ERR!
2019-10-10T20:55:03.45864+00:00 app[web.1]: npm ERR! Failed at the mern#1.0.0 start script.
2019-10-10T20:55:03.458836+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-10-10T20:55:03.477987+00:00 app[web.1]:
2019-10-10T20:55:03.481718+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-10-10T20:55:03.481808+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-10-10T20_55_03_460Z-debug.log
2019-10-10T20:55:03.545013+00:00 heroku[web.1]: Process exited with status 1
2019-10-10T20:55:03.590878+00:00 heroku[web.1]: State changed from starting to crashed
2019-10-10T21:05:03.51307+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=HEAD path="/" host=butterflysocial.herokuapp.com request_id=fe75c157-e88e-4ca7-b764-32d93928a0e6 fwd="217.182.175.162" dyno= connect= service= status=503 bytes= protocol=https
2019-10-10T21:06:36.454645+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=butterflysocial.herokuapp.com request_id=58559acb-45a6-4d8e-b6e0-38e757eca259 fwd="199.185.67.21" dyno= connect= service= status=503 bytes= protocol=https
2019-10-10T21:06:36.326591+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=butterflysocial.herokuapp.com request_id=95fa4af1-c658-4bfc-a56a-2604aeda2e3b fwd="18.236.7.105" dyno= connect= service= status=503 bytes= protocol=http
2019-10-10T21:06:39.322455+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=butterflysocial.herokuapp.com request_id=7b0ec73c-cfcf-428f-a2f2-a8067e621627 fwd="199.185.67.21" dyno= connect= service= status=503 bytes= protocol=https
2019-10-10T21:08:55.015408+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=butterflysocial.herokuapp.com request_id=f1f065b2-ee5c-4a6b-86e0-39a54898d9b4 fwd="89.247.167.20" dyno= connect= service= status=503 bytes= protocol=https
2019-10-10T21:08:55.447502+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=butterflysocial.herokuapp.com request_id=29cf9121-5e49-48c3-9404-9b61112d9d74 fwd="89.247.167.20" dyno= connect= service= status=503 bytes= protocol=https
I've been trying to fix a heroku api but I keep getting an error which I cant fix. The app is not even running, it goes straight to the error. It was working until I recently made an update to the api.
The error is shown as
2019-10-18T21:40:06.936984+00:00 app[web.1]: at Function.Module._load
(internal/modules/cjs/loader.js:585:3)
2019-10-18T21:40:06.936986+00:00 app[web.1]: at Module.require
(internal/modules/cjs/loader.js:692:17)
2019-10-18T21:40:06.936988+00:00 app[web.1]: at require
(internal/modules/cjs/helpers.js:25:18)
2019-10-18T21:40:06.936989+00:00 app[web.1]: at Object.<anonymous> (/app/routes/api.js:7:16)
2019-10-18T21:40:06.936991+00:00 app[web.1]: at Module._compile
(internal/modules/cjs/loader.js:778:30)
2019-10-18T21:40:06.944691+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-10-18T21:40:06.945081+00:00 app[web.1]: npm ERR! errno 1
2019-10-18T21:40:06.946204+00:00 app[web.1]: npm ERR! quickJobs-api#1.0.0 start: `node
server.js`
2019-10-18T21:40:06.946319+00:00 app[web.1]: npm ERR! Exit status 1
2019-10-18T21:40:06.946542+00:00 app[web.1]: npm ERR!
2019-10-18T21:40:06.946663+00:00 app[web.1]: npm ERR! Failed at the quickJobs-api#1.0.0 start script.
2019-10-18T21:40:06.946779+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-10-18T21:40:06.953214+00:00 app[web.1]:
2019-10-18T21:40:06.953367+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-10-18T21:40:06.953452+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-10-18T21_40_06_948Z-debug.log
2019-10-18T21:40:07.008783+00:00 heroku[web.1]: Process exited with status 1
2019-10-18T21:40:24.571093+00:00 heroku[web.1]: State changed from crashed to starting
2019-10-18T22:05:16.977483+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=quickjobsapi.herokuapp.com request_id=a50a5c3e-7152-4ce1-942f-df572188531b fwd="63.143.196.162" dyno= connect= serv
ice= status=503 bytes= protocol=https
2019-10-18T22:05:17.639126+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=quickjobsapi.herokuapp.com request_id=405f9fd7-ae38-478e-b182-7e5306ab0fa6 fwd="63.143.196.162" dyno= co
nnect= service= status=503 bytes= protocol=https
2019-10-18T22:05:48.086732+00:00 heroku[web.1]: State changed from crashed to starting
2019-10-18T22:05:50.688489+00:00 heroku[web.1]: Starting process with command `npm start`
2019-10-18T22:05:53.119843+00:00 app[web.1]:
2019-10-18T22:05:53.119869+00:00 app[web.1]: > quickJobs-api#1.0.0 start /app
2019-10-18T22:05:53.119871+00:00 app[web.1]: > node server.js
2019-10-18T22:05:53.119872+00:00 app[web.1]:
2019-10-18T22:05:54.001916+00:00 heroku[web.1]: State changed from starting to crashed
2019-10-18T22:05:53.873724+00:00 app[web.1]: internal/modules/cjs/loader.js:807
2019-10-18T22:05:53.873754+00:00 app[web.1]: return process.dlopen(module, path.toNamespacedPath(filename));
2019-10-18T22:05:53.873756+00:00 app[web.1]: ^
2019-10-18T22:05:53.873758+00:00 app[web.1]:
2019-10-18T22:05:53.873760+00:00 app[web.1]: Error: /app/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header
2019-10-18T22:05:53.873761+00:00 app[web.1]: at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
2019-10-18T22:05:53.873763+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2019-10-18T22:05:53.873765+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2019-10-18T22:05:53.873767+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2019-10-18T22:05:53.873768+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:692:17)
2019-10-18T22:05:53.873770+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2019-10-18T22:05:53.873771+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/bcrypt/bcrypt.js:6:16)
2019-10-18T22:05:53.873773+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:778:30)
2019-10-18T22:05:53.882321+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-10-18T22:05:53.882732+00:00 app[web.1]: npm ERR! errno 1
2019-10-18T22:05:53.883970+00:00 app[web.1]: npm ERR! quickJobs-api#1.0.0 start: `node server.js`
2019-10-18T22:05:53.884082+00:00 app[web.1]: npm ERR! Exit status 1
2019-10-18T22:05:53.884277+00:00 app[web.1]: npm ERR!
2019-10-18T22:05:53.884398+00:00 app[web.1]: npm ERR! Failed at the quickJobs-api#1.0.0 start script.
2019-10-18T22:05:53.884514+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-10-18T22:05:53.914312+00:00 app[web.1]:
2019-10-18T22:05:53.914489+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-10-18T22:05:53.914584+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-10-18T22_05_53_885Z-debug.log
2019-10-18T22:05:54.019964+00:00 heroku[web.1]: State changed from crashed to starting
2019-10-18T22:05:53.977749+00:00 heroku[web.1]: Process exited with status 1
2019-10-18T22:05:57.322980+00:00 heroku[web.1]: Starting process with command `npm start`
2019-10-18T22:06:00.008642+00:00 app[web.1]:
2019-10-18T22:06:00.008674+00:00 app[web.1]: > quickJobs-api#1.0.0 start /app
2019-10-18T22:06:00.008676+00:00 app[web.1]: > node server.js
2019-10-18T22:06:00.008678+00:00 app[web.1]:
2019-10-18T22:06:00.907169+00:00 app[web.1]: internal/modules/cjs/loader.js:807
2019-10-18T22:06:00.907208+00:00 app[web.1]: return process.dlopen(module, path.toNamespacedPath(filename));
2019-10-18T22:06:00.907211+00:00 app[web.1]: ^
2019-10-18T22:06:00.907214+00:00 app[web.1]:
2019-10-18T22:06:00.907216+00:00 app[web.1]: Error: /app/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header
2019-10-18T22:06:00.907218+00:00 app[web.1]: at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
2019-10-18T22:06:00.907220+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2019-10-18T22:06:00.907223+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2019-10-18T22:06:00.907225+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2019-10-18T22:06:00.907228+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:692:17)
2019-10-18T22:06:00.907229+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2019-10-18T22:06:00.907232+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/bcrypt/bcrypt.js:6:16)
2019-10-18T22:06:00.907234+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:778:30)
2019-10-18T22:06:00.907235+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
2019-10-18T22:06:00.907238+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2019-10-18T22:06:00.907242+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2019-10-18T22:06:00.907244+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2019-10-18T22:06:00.907247+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:692:17)
2019-10-18T22:06:00.907249+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2019-10-18T22:06:00.907251+00:00 app[web.1]: at Object.<anonymous> (/app/routes/api.js:7:16)
2019-10-18T22:06:00.907253+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:778:30)
2019-10-18T22:06:00.925298+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-10-18T22:06:00.925759+00:00 app[web.1]: npm ERR! errno 1
2019-10-18T22:06:00.926956+00:00 app[web.1]: npm ERR! quickJobs-api#1.0.0 start: `node server.js`
2019-10-18T22:06:00.927125+00:00 app[web.1]: npm ERR! Exit status 1
2019-10-18T22:06:00.927387+00:00 app[web.1]: npm ERR!
2019-10-18T22:06:00.927644+00:00 app[web.1]: npm ERR! Failed at the quickJobs-api#1.0.0 start script.
2019-10-18T22:06:00.927832+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-10-18T22:06:00.942491+00:00 app[web.1]:
2019-10-18T22:06:00.942496+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-10-18T22:06:00.942498+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-10-18T22_06_00_929Z-debug.log
2019-10-18T22:06:01.013650+00:00 heroku[web.1]: State changed from starting to crashed
2019-10-18T22:06:00.991627+00:00 heroku[web.1]: Process exited with status 1
Git
2019-10-18T22:06:00.778487+00:00 heroku[web.1]: State changed from starting to up
2019-10-18T22:06:01.574620+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=quickjobsapi.herokuapp.com request_id=e500ac9e-cc2f-4cde-9f91-8424f36c57f2 fwd="63.143.196.162" dyno= connect= serv
ice= status=503 bytes= protocol=https
2019-10-18T22:06:02.282334+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=quickjobsapi.herokuapp.com request_id=38013505-dfbc-4e8a-90e4-e55077f9b467 fwd="63.143.196.162" dyno= co
nnect= service= status=503 bytes= protocol=https
My server.js file has
const express = require('express')
const bodyParser = require('body-parser')
const cors = require('cors')
const app = express()
app.use(cors())
//const PORT = process.env.PORT || 3000;
app.listen(process.env.PORT || 3000,function(){
console.log('server has been started')
})
app.use(bodyParser.json({limit: "500mb"}));
app.use(bodyParser.urlencoded({limit: "500mb", extended: true, parameterLimit:50000}));
app.use('/api',require('./routes/api'))
The other files are just the api and the schema for mongodb.
Please help
I see that there is a bcrypt related error. Are you using different Node.js version on your local dev and your prod? If yes then try to ignore the package manager lock file yarn.lock or package-lock.json.
lock file usually "hold" version specific dependency, in some case package with native dependency like bcrypt can cause some issue.
When trying to deploy to Heroku I didn't have a problem however when trying to access my Heroku URL I got an "Application error". After executing heroku logs, I got the error Cannot find module 'async'. I installed it and I am async/await only inside this function. Could someone help me solve this issue?
const express = require('express');
const router = express.Router();
const Rental = require('../models/rental');
const User = require('../models/user');
const { normalizedErrors } = require('../helpers/mongoose')
var flatten = require('array-flatten')
var Promise = require('Promise');
var async = require('async');
router.get('', async function (req, res) {
let finalResults = [];
let dummyArray = [''];
let resolvedFinalArray = await Promise.all(dummyArray.map(async (value) => {
const result = await getRentalsByQuery({});
finalValue = result;
return finalValue;
}));
finalResults.push(resolvedFinalArray);
finalResults = flatten(finalResults);
if (req.query.filters) {
const queryObj = JSON.parse(req.query.filters);
if (queryObj.title) {
// SOME ASYNC OPERATIONS with foundRentals
}
}
//clean resolvedFinalArray for sending as a simple array json
finalResults = flatten(finalResults)
res.json(finalResults);
});
Here is the error detail:
2018-12-08T06:09:01.416754+00:00 app[web.1]:
2018-12-08T06:09:02.649330+00:00 app[web.1]: internal/modules/cjs/loader.js:582
2018-12-08T06:09:02.649344+00:00 app[web.1]: throw err;
2018-12-08T06:09:02.649346+00:00 app[web.1]: ^
2018-12-08T06:09:02.649347+00:00 app[web.1]:
2018-12-08T06:09:02.649348+00:00 app[web.1]: Error: Cannot find module 'async'
2018-12-08T06:09:02.649350+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
2018-12-08T06:09:02.649351+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:506:25)
2018-12-08T06:09:02.649353+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:636:17)
2018-12-08T06:09:02.649354+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:20:18)
2018-12-08T06:09:02.649355+00:00 app[web.1]: at Object.<anonymous> (/app/server/routes/rentals.js:8:13)
2018-12-08T06:09:02.649357+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:688:30)
2018-12-08T06:09:02.649358+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
2018-12-08T06:09:02.649359+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:598:32)
2018-12-08T06:09:02.649361+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
2018-12-08T06:09:02.649362+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:529:3)
2018-12-08T06:09:02.649363+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:636:17)
2018-12-08T06:09:02.649364+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:20:18)
2018-12-08T06:09:02.649365+00:00 app[web.1]: at Object.<anonymous> (/app/server/index.js:8:22)
2018-12-08T06:09:02.649367+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:688:30)
2018-12-08T06:09:02.649368+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
2018-12-08T06:09:02.649369+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:598:32)
2018-12-08T06:09:02.672674+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-12-08T06:09:02.673564+00:00 app[web.1]: npm ERR! errno 1
2018-12-08T06:09:02.676119+00:00 app[web.1]: npm ERR! server#1.0.0 start: `node index.js`
2018-12-08T06:09:02.676416+00:00 app[web.1]: npm ERR! Exit status 1
2018-12-08T06:09:02.677167+00:00 app[web.1]: npm ERR!
2018-12-08T06:09:02.677417+00:00 app[web.1]: npm ERR! Failed at the server#1.0.0 start script.
2018-12-08T06:09:02.677805+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-12-08T06:09:02.696205+00:00 app[web.1]: npm WARN Local package.json exists, but node_modules missing, did you mean to install?
2018-12-08T06:09:02.697621+00:00 app[web.1]:
2018-12-08T06:09:02.698037+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-12-08T06:09:02.698297+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2018-12-08T06_09_02_682Z-debug.log
2018-12-08T06:09:02.713718+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-12-08T06:09:02.714599+00:00 app[web.1]: npm ERR! errno 1
2018-12-08T06:09:02.718363+00:00 app[web.1]: npm ERR! angular-starter#0.0.0 start: `npm run start --prefix server`
2018-12-08T06:09:02.718847+00:00 app[web.1]: npm ERR! Exit status 1
2018-12-08T06:09:02.719560+00:00 app[web.1]: npm ERR!
2018-12-08T06:09:02.719990+00:00 app[web.1]: npm ERR! Failed at the angular-starter#0.0.0 start script.
2018-12-08T06:09:02.720570+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-12-08T06:09:02.735159+00:00 app[web.1]:
2018-12-08T06:09:02.735523+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-12-08T06:09:02.735769+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2018-12-08T06_09_02_724Z-debug.log
2018-12-08T06:09:14.369444+00:00 app[web.1]:
2018-12-08T06:09:14.369473+00:00 app[web.1]: > angular-starter#0.0.0 start /app
2018-12-08T06:09:14.369475+00:00 app[web.1]: > npm run start --prefix server
2018-12-08T06:09:14.369477+00:00 app[web.1]:
2018-12-08T06:09:15.403449+00:00 app[web.1]:
2018-12-08T06:09:15.403494+00:00 app[web.1]: > server#1.0.0 start /app/server
2018-12-08T06:09:15.403496+00:00 app[web.1]: > node index.js
2018-12-08T06:09:15.403497+00:00 app[web.1]:
Check 'async' in node_modules ,because your loader log "Cannot find module 'async'"
first npm i --save async, then restart your app
I am new to Node.js and Heroku and am trying to host my first application on Heroku but am having issues with the deployment. I have been following this tutorial to deploy the app: https://scotch.io/tutorials/use-mongodb-with-a-node-application-on-heroku
In cmd prompt I have done the following:
1. heroku
2. heroku login
3. heroku create app
4. git push heroku master
5. heroku ps:scale web=1
6. heroku open
7. heroku logs --tail (below is a list of the log messages I see after heroku open)
On my mLab console I have created a database, collection and user and defined my mongo URI as the following:
'mongodb://admin:********#asdf1234.mlab.com:13122/app'
If I start my Node app locally, I can successfully create data into this database, but when I try to access my app from Heroku, I get the application error webpage. I know I must be missing a steps somewhere? I believe this is related to Mongoose?
2016-05-03T02:27:29.458496+00:00 heroku[web.1]: State changed from crashed to starting
2016-05-03T02:27:33.077531+00:00 heroku[web.1]: Starting process with command `npm start`
2016-05-03T02:27:35.383818+00:00 app[web.1]:
2016-05-03T02:27:35.383872+00:00 app[web.1]: > app#0.0.0 start /app
2016-05-03T02:27:35.383878+00:00 app[web.1]: > node ./bin/www
2016-05-03T02:27:35.383887+00:00 app[web.1]:
2016-05-03T02:27:35.587955+00:00 app[web.1]: { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
2016-05-03T02:27:35.589136+00:00 app[web.1]: js-bson: Failed to load c++ bson extension, using pure JS version
2016-05-03T02:27:35.947930+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2016-05-03T02:27:35.947945+00:00 app[web.1]: designed for a production environment, as it will leak
2016-05-03T02:27:35.947946+00:00 app[web.1]: memory, and will not scale past a single process.
2016-05-03T02:27:35.986323+00:00 app[web.1]:
2016-05-03T02:27:35.986338+00:00 app[web.1]: /app/node_modules/mongoose/node_modules/mongodb/lib/server.js:242
2016-05-03T02:27:35.986339+00:00 app[web.1]: process.nextTick(function() { throw err; })
2016-05-03T02:27:35.986341+00:00 app[web.1]: ^
2016-05-03T02:27:35.986344+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0.1:27017
2016-05-03T02:27:35.986345+00:00 app[web.1]: at Object.exports._errnoException (util.js:893:11)
2016-05-03T02:27:35.986346+00:00 app[web.1]: at exports._exceptionWithHostPort (util.js:916:20)
2016-05-03T02:27:35.986347+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1075:14)
2016-05-03T02:27:35.997520+00:00 app[web.1]:
2016-05-03T02:27:36.009323+00:00 app[web.1]: npm ERR! Linux 3.13.0-79-generic
2016-05-03T02:27:36.009834+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-05-03T02:27:36.010139+00:00 app[web.1]: npm ERR! node v5.11.0
2016-05-03T02:27:36.010913+00:00 app[web.1]: npm ERR! npm v3.8.6
2016-05-03T02:27:36.011252+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-05-03T02:27:36.011483+00:00 app[web.1]: npm ERR! app#0.0.0 start: `node ./bin/www`
2016-05-03T02:27:36.011697+00:00 app[web.1]: npm ERR! Exit status 1
2016-05-03T02:27:36.011937+00:00 app[web.1]: npm ERR!
2016-05-03T02:27:36.012344+00:00 app[web.1]: npm ERR! Failed at the app#0.0.0 start script 'node ./bin/www'.
2016-05-03T02:27:36.012587+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2016-05-03T02:27:36.012830+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the app package,
2016-05-03T02:27:36.013080+00:00 app[web.1]: npm ERR! not with npm itself.
2016-05-03T02:27:36.013296+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-05-03T02:27:36.013522+00:00 app[web.1]: npm ERR! node ./bin/www
2016-05-03T02:27:36.013730+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-05-03T02:27:36.013943+00:00 app[web.1]: npm ERR! npm bugs app
2016-05-03T02:27:36.014152+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-05-03T02:27:36.014360+00:00 app[web.1]: npm ERR! npm owner ls app
2016-05-03T02:27:36.014579+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-05-03T02:27:36.021124+00:00 app[web.1]:
2016-05-03T02:27:36.021429+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-05-03T02:27:36.021644+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-05-03T02:27:36.772785+00:00 heroku[web.1]: Process exited with status 1
2016-05-03T02:27:36.779023+00:00 heroku[web.1]: State changed from starting to crashed
My package.json file looks like this if that helps:
{
"name": "app",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"bcrypt-nodejs": "0.0.3",
"body-parser": "~1.13.2",
"connect-flash": "^0.1.1",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"express-session": "^1.13.0",
"jade": "~1.11.0",
"mongodb": "~1.4.4",
"mongoose": "^4.4.6",
"monk": "~1.0.1",
"morgan": "~1.6.1",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"serve-favicon": "~2.3.0"
}
}
Thanks for the help!
EDIT:
All I was missing was the node version in my package.json, the following fixed it for me:
"engines": {
"node": "4.3.2"
},
The following error:
Error: connect ECONNREFUSED 127.0.0.1:27017
Basically says it's trying to connect to MongoDB on 127.0.0.1 which would be the Heroku container not mLab, are you sure you are reading the MongoDB url from Process.env and trying to connect to that url?
My Heroku app is crashing, I believe before it even gets to the Procfile. I am experiencing the same problem as here:
Cannot execute Node.js app on Heroku successfully (crashes each time)
The only difference is that my package.json file has Express included
package.json
{
"name": "weathersocket",
"version": "0.0.1",
"description": "text based weather",
"main": "weather.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/agreen757/weathersocket.github.io"
},
"keywords": [
"demo",
"heroku",
"weather"
],
"author": "Adrian Green",
"license": "MIT",
"bugs": {
"url": "https://github.com/agreen757/weathersocket.github.io/issues"
},
"homepage": "https://github.com/agreen757/weathersocket.github.io",
"dependencies": {
"body-parser": "^1.6.6",
"consolidate": "^0.10.0",
"cookie-parser": "^1.3.2",
"express": "^4.8.6",
"mongodb": "^1.4.9",
"socket.io": "^1.0.6",
"swig": "^1.4.2"
}
}
I have tried to the foreman utility locally and everything works properly.
My main weather.js file contains:
server.listen(4000);
console.log("Express server started on 4000");
Any help would be greatly appreciated.
Update: Heroku logs
`2014-08-28T14:29:14.866955+00:00 heroku[web.1]: State changed from crashed to starting
2014-08-28T14:29:18.414238+00:00 app[web.1]:
2014-08-28T14:29:18.414259+00:00 app[web.1]: > node weather.js
2014-08-28T14:29:18.414257+00:00 app[web.1]: > weathersocket#10.3.1 start /app
2014-08-28T14:29:18.414260+00:00 app[web.1]:
2014-08-28T14:29:18.755300+00:00 app[web.1]:
2014-08-28T14:29:18.755380+00:00 app[web.1]: module.js:340
2014-08-28T14:29:18.755637+00:00 app[web.1]: throw err;
2014-08-28T14:29:18.755646+00:00 app[web.1]: ^
2014-08-28T14:29:18.757013+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:338:15)
2014-08-28T14:29:18.757015+00:00 app[web.1]: at Function.Module._load (module.js:280:25)
2014-08-28T14:29:18.757011+00:00 app[web.1]: Error: Cannot find module 'socket.io'
2014-08-28T14:29:18.757016+00:00 app[web.1]: at Module.require (module.js:364:17)
2014-08-28T14:29:18.757017+00:00 app[web.1]: at require (module.js:380:17)
2014-08-28T14:29:18.757019+00:00 app[web.1]: at Object.<anonymous> (/app/weather.js:6:10)
2014-08-28T14:29:18.757020+00:00 app[web.1]: at Module._compile (module.js:456:26)
2014-08-28T14:29:18.757022+00:00 app[web.1]: at Object.Module._extensions..js (module.js:474:10)
2014-08-28T14:29:18.757023+00:00 app[web.1]: at Module.load (module.js:356:32)
2014-08-28T14:29:18.757025+00:00 app[web.1]: at Function.Module._load (module.js:312:12)
2014-08-28T14:29:18.757026+00:00 app[web.1]: at Function.Module.runMain (module.js:497:10)
2014-08-28T14:29:18.765774+00:00 app[web.1]:
2014-08-28T14:29:18.770873+00:00 app[web.1]: npm ERR!
2014-08-28T14:29:18.770460+00:00 app[web.1]: npm ERR! weathersocket#10.3.1 start: `node weather.js`
2014-08-28T14:29:18.770720+00:00 app[web.1]: npm ERR! Exit status 8
2014-08-28T14:29:18.770945+00:00 app[web.1]: npm ERR! Failed at the weathersocket#10.3.1 start script.
2014-08-28T14:29:18.771539+00:00 app[web.1]: npm ERR! This is most likely a problem with the weathersocket package,
2014-08-28T14:29:18.771696+00:00 app[web.1]: npm ERR! not with npm itself.
2014-08-28T14:29:18.771844+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2014-08-28T14:29:18.772002+00:00 app[web.1]: npm ERR! node weather.js
2014-08-28T14:29:18.772821+00:00 app[web.1]: npm ERR! System Linux 3.8.11-ec2
2014-08-28T14:29:18.773778+00:00 app[web.1]: npm ERR! npm -v 1.4.23
2014-08-28T14:29:18.772468+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2014-08-28T14:29:18.773030+00:00 app[web.1]: npm ERR! command "/app/vendor/node/bin/node" "/app/vendor/node/bin/npm" "start"
2014-08-28T14:29:18.773608+00:00 app[web.1]: npm ERR! node -v v0.10.31
2014-08-28T14:29:18.772297+00:00 app[web.1]: npm ERR! npm owner ls weathersocket
2014-08-28T14:29:18.775689+00:00 app[web.1]: npm ERR! Additional logging details can be found in:
2014-08-28T14:29:18.772151+00:00 app[web.1]: npm ERR! You can get their info via:
2014-08-28T14:29:18.773383+00:00 app[web.1]: npm ERR! cwd /app
2014-08-28T14:29:18.775539+00:00 app[web.1]: npm ERR!
2014-08-28T14:29:18.773965+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2014-08-28T14:29:18.776097+00:00 app[web.1]: npm ERR! not ok code 0
2014-08-28T14:29:18.775840+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2014-08-28T14:29:19.793237+00:00 heroku[web.1]: State changed from starting to crashed
2014-08-28T14:29:16.891824+00:00 heroku[web.1]: Starting process with command `npm start`
2014-08-28T14:29:19.781258+00:00 heroku[web.1]: Process exited with status 1`
I see a few things you could improve, as fakemeta states in his commentary, you should be using the heroku variables to listen port and to have the IP.
You should also include in your package.json:
"scripts": {
"start": "node server.js"
},
"main": "server.js"
So the system know what to do and where is your express server
//-------------EDIT----------------------------//
Cant you try to deploy without node_modules folder?, once you push heroku will install those packages, i mean at least just for debugging purposes