У меня есть этот проект, работающий локально, и, кажется, он взаимодействует с базой данных mLab на heroku, когда я сохраняю информацию через свой локальный хост. Тем не менее, когда я использую ссылку heroku, я получаю сообщение об ошибке приложения, которое говорит мне, чтобы посмотреть журналы. Я разместил фотографию полного журнала ниже.
Вот ссылка на репозиторий: https://github.com/TheGreekCuban/ButterflySocial Развернутая ссылка Heroku: https://butterflysocial.herokuapp.com/
Я попытался удалить package-lock.json и модули узлов, у меня естьубедившись, что мои переменные конфигурации совпадают, я прочитал все подобные материалы в Интернете и до сих пор не могу понять это. Я думаю, что это связано с:
- Процесс сборки
- Соединение mlab
См. Сообщения об ошибках ниже.
Я ожидаю, что приложение будет работать так же, как и локально. Сообщения об ошибках при записи логов heroku --tail:
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