Heroku, mLab and Node.js: Application Error - Mongoose - javascript

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?

Related

Node.js app not deploying correctly on Heroku

My repository: https://github.com/jacklemasters/tech-blog
The app works locally on my machine, but I cannot seem to figure out why it will not work on Heroku. I have attempted completely moving the code, a new repository, nothing seems to help.
Here are the error logs I am receiving from Heroku:
2021-10-04T14:32:52.833339+00:00 app[web.1]: npm ERR! tech-blog#1.0.0 start: node server.js
2021-10-04T14:32:52.833414+00:00 app[web.1]: npm ERR! Exit status 1
2021-10-04T14:32:52.833484+00:00 app[web.1]: npm ERR!
2021-10-04T14:32:52.833533+00:00 app[web.1]: npm ERR! Failed at the tech-blog#1.0.0 start script.
2021-10-04T14:32:52.833601+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-04T14:32:52.847732+00:00 app[web.1]:
2021-10-04T14:32:52.847831+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-04T14:32:52.847916+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-10-04T14_32_52_834Z-debug.log
2021-10-04T14:32:53.006395+00:00 heroku[web.1]: Process exited with status 1
2021-10-04T14:32:53.089213+00:00 heroku[web.1]: State changed from starting to crashed
edit: I understand it could be something with my packages, but on my side I see them as installed. Still at a loss!
You are using libraries that you didn't import into the package.json with npm.
Example: npm install express-session
Other thing that is wrong is to upload the .dotenv file to GitHub. Use the .gitignore to avoid it and configure the heroku envorinment variables. See more here: https://devcenter.heroku.com/articles/config-vars

MERN Heorku App Works Locally, Stores Data In MLAB but wont work using deployment link

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

heroku logs sh: 1: concurrently: not found

2017-10-08T20:06:11.093118+00:00 heroku[web.1]: Starting process with command `npm start`
2017-10-08T20:06:15.431068+00:00 app[web.1]:
2017-10-08T20:06:15.431083+00:00 app[web.1]: > shopping-cart-app#0.1.0 start /app
2017-10-08T20:06:15.431084+00:00 app[web.1]: > concurrently "npm run server" "npm run client"
2017-10-08T20:06:15.439379+00:00 app[web.1]: sh: 1: concurrently: not found
2017-10-08T20:06:15.446591+00:00 app[web.1]: npm ERR! file sh
2017-10-08T20:06:15.431085+00:00 app[web.1]:
2017-10-08T20:06:15.447135+00:00 app[web.1]: npm ERR! errno ENOENT
2017-10-08T20:06:15.447368+00:00 app[web.1]: npm ERR! syscall spawn
2017-10-08T20:06:15.446893+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-10-08T20:06:15.453425+00:00 app[web.1]: npm ERR!
2017-10-08T20:06:15.448865+00:00 app[web.1]: npm ERR! shopping-cart-app#0.1.0 start: `concurrently "npm run server" "npm run client"`
2017-10-08T20:06:15.453636+00:00 app[web.1]: npm ERR! Failed at the shopping-cart-app#0.1.0 start script.
2017-10-08T20:06:15.464269+00:00 app[web.1]:
2017-10-08T20:06:15.453115+00:00 app[web.1]: npm ERR! spawn ENOENT
2017-10-08T20:06:15.453824+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2017-10-08T20:06:15.469282+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2017-10-08T20:06:15.469426+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2017-10-08T20_06_15_456Z-debug.log
2017-10-08T20:06:15.625015+00:00 heroku[web.1]: State changed from starting to crashed
2017-10-08T20:06:15.627831+00:00 heroku[web.1]: State changed from crashed to starting
2017-10-08T20:06:15.609086+00:00 heroku[web.1]: Process exited with status 1
2017-10-08T20:06:20.543684+00:00 heroku[web.1]: Starting process with command `npm start`
2017-10-08T20:06:23.048216+00:00 heroku[web.1]: Process exited with status 1
2017-10-08T20:06:22.944636+00:00 app[web.1]: > shopping-cart-app#0.1.0 start /app
2017-10-08T20:06:22.944621+00:00 app[web.1]:
2017-10-08T20:06:22.944637+00:00 app[web.1]: > concurrently "npm run server" "npm run client"
2017-10-08T20:06:22.944637+00:00 app[web.1]:
2017-10-08T20:06:22.951908+00:00 app[web.1]: sh: 1: concurrently: not found
2017-10-08T20:06:22.957587+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-10-08T20:06:22.957261+00:00 app[web.1]: npm ERR! file sh
2017-10-08T20:06:22.957843+00:00 app[web.1]: npm ERR! errno ENOENT
2017-10-08T20:06:22.959735+00:00 app[web.1]: npm ERR! spawn ENOENT
2017-10-08T20:06:22.958098+00:00 app[web.1]: npm ERR! syscall spawn
2017-10-08T20:06:22.959544+00:00 app[web.1]: npm ERR! shopping-cart-app#0.1.0 start: `concurrently "npm run server" "npm run client"`
2017-10-08T20:06:22.960008+00:00 app[web.1]: npm ERR!
2017-10-08T20:06:22.960225+00:00 app[web.1]: npm ERR! Failed at the shopping-cart-app#0.1.0 start script.
2017-10-08T20:06:22.966218+00:00 app[web.1]:
2017-10-08T20:06:22.966570+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2017-10-08T20_06_22_962Z-debug.log
2017-10-08T20:06:22.960452+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2017-10-08T20:06:22.966432+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2017-10-08T20:06:23.060706+00:00 heroku[web.1]: State changed from starting to crashed
I can run the app on my localhost but it crashes in heroku. It seems that I am having issues with the concurrently package while starting app in heroku. I used npm i -S concurrently but it downloads under dev dependancies. Is there some type of setting in Heroku that I need to change to use concurrently?
apt-get install nodejs-legacy
npm install -g tsc
npm install -g concurrently
npm install -g typescript
try this command

How to deploy a nodejs app to heroku with github

i want to deploy this application https://github.com/thefailtheory/neofreelance i am developping on my http://livecoding.tv channel
to heroku but i am facing an error
the application is basic it will try to solve a problem on freelancing in the cloud i use everyday
here is the log :
2016-11-22T16:20:34.454131+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-11-22T16:20:34.454297+00:00 app[web.1]: npm ERR! neofreelance#1.0.0 start: `node app.js`
2016-11-22T16:20:34.454450+00:00 app[web.1]: npm ERR! Exit status 1
2016-11-22T16:20:34.454616+00:00 app[web.1]: npm ERR!
2016-11-22T16:20:34.454772+00:00 app[web.1]: npm ERR! Failed at the neofreelance#1.0.0 start script 'node app.js'.
2016-11-22T16:20:34.454931+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2016-11-22T16:20:34.455081+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the neofreelance package,
2016-11-22T16:20:34.455232+00:00 app[web.1]: npm ERR! not with npm itself.
2016-11-22T16:20:34.455378+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-11-22T16:20:34.455537+00:00 app[web.1]: npm ERR! node app.js
2016-11-22T16:20:34.455684+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-11-22T16:20:34.455833+00:00 app[web.1]: npm ERR! npm bugs neofreelance
2016-11-22T16:20:34.456007+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-11-22T16:20:34.456156+00:00 app[web.1]: npm ERR! npm owner ls neofreelance
2016-11-22T16:20:34.456302+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-11-22T16:20:34.459887+00:00 app[web.1]:
2016-11-22T16:20:34.460174+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-11-22T16:20:34.460356+00:00 app[web.1]: npm ERR! /app/npm-debug.log
That is because Block-scoped declarations (let, const) are not yet supported in the Node version Heroku is using outside of strict mode.
So two options:
Add "use strict"; at the beginning of your file
Use var and not let.

Heroku Node.js App Crashing | module.js:340 error

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

Categories

Resources