#node.js #heroku
#node.js #heroku
Вопрос:
У меня закончились решения моей проблемы. Я пытался развернуть свой сервер nodejs с помощью Heroku, и по какой-то причине (я перепробовал все) у меня все те же проблемы. Если я использую команду heroku run bash и запускаю свой сценарий запуска, я работаю как шарм, но когда я запускаю heroku open…
2020-12-07T23:42:24.926855 00:00 app[web.1]: - /app/controllers/delivery.controller.js
2020-12-07T23:42:24.926856 00:00 app[web.1]: - /app/routes/delivery.routes.js
2020-12-07T23:42:24.926856 00:00 app[web.1]: - /app/app.js
2020-12-07T23:42:24.926875 00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
2020-12-07T23:42:24.926875 00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:667:27)
2020-12-07T23:42:24.926876 00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:887:19)
2020-12-07T23:42:24.926876 00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2020-12-07T23:42:24.926876 00:00 app[web.1]: at Object.<anonymous> (/app/models/dbServices.js:1:15)
2020-12-07T23:42:24.926877 00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:999:30)
2020-12-07T23:42:24.926877 00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
2020-12-07T23:42:24.926877 00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:863:32)
2020-12-07T23:42:24.926878 00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:708:14)
2020-12-07T23:42:24.926878 00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:887:19) {
2020-12-07T23:42:24.926878 00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-12-07T23:42:24.926878 00:00 app[web.1]: requireStack: [
2020-12-07T23:42:24.926879 00:00 app[web.1]: '/app/models/dbServices.js',
2020-12-07T23:42:24.926879 00:00 app[web.1]: '/app/models/delivery.models.js',
2020-12-07T23:42:24.926879 00:00 app[web.1]: '/app/controllers/delivery.controller.js',
2020-12-07T23:42:24.926880 00:00 app[web.1]: '/app/routes/delivery.routes.js',
2020-12-07T23:42:24.926880 00:00 app[web.1]: '/app/app.js'
2020-12-07T23:42:24.926880 00:00 app[web.1]: ]
2020-12-07T23:42:24.926881 00:00 app[web.1]: }
2020-12-07T23:42:25.014284 00:00 heroku[web.1]: Process exited with status 1
2020-12-07T23:42:25.058934 00:00 heroku[web.1]: State changed from starting to crashed
2020-12-07T23:42:25.823592 00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=brocoliserver.herokuapp.com request_id=363aee5c-8262-4319-a958-0a07501fee51 fwd="88.125.237.207" dyno= connect= service= status=503 bytes= protocol=https
2020-12-07T23:48:28.000000 00:00 app[api]: Build started by user emmanuelle.zenou.rogala@gmail.com
2020-12-07T23:48:45.000000 00:00 app[api]: Build succeeded
2020-12-07T23:48:45.389699 00:00 app[api]: Release v11 created by user emmanuelle.zenou.rogala@gmail.com
2020-12-07T23:48:45.389699 00:00 app[api]: Deploy 0d98c876 by user emmanuelle.zenou.rogala@gmail.com
2020-12-07T23:48:46.665684 00:00 heroku[web.1]: State changed from crashed to starting
2020-12-07T23:48:49.418790 00:00 heroku[web.1]: Starting process with command `node app.js`
2020-12-07T23:48:52.552335 00:00 app[web.1]: internal/modules/cjs/loader.js:818
2020-12-07T23:48:52.552366 00:00 app[web.1]: throw err;
2020-12-07T23:48:52.552367 00:00 app[web.1]: ^
2020-12-07T23:48:52.552367 00:00 app[web.1]:
2020-12-07T23:48:52.552368 00:00 app[web.1]: Error: Cannot find module 'mysql'
2020-12-07T23:48:52.552368 00:00 app[web.1]: Require stack:
2020-12-07T23:48:52.552368 00:00 app[web.1]: - /app/models/dbServices.js
2020-12-07T23:48:52.552369 00:00 app[web.1]: - /app/models/delivery.models.js
2020-12-07T23:48:52.552369 00:00 app[web.1]: - /app/controllers/delivery.controller.js
2020-12-07T23:48:52.552370 00:00 app[web.1]: - /app/routes/delivery.routes.js
2020-12-07T23:48:52.552370 00:00 app[web.1]: - /app/app.js
2020-12-07T23:48:52.552387 00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
2020-12-07T23:48:52.552388 00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:667:27)
2020-12-07T23:48:52.552388 00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:887:19)
2020-12-07T23:48:52.552389 00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2020-12-07T23:48:52.552389 00:00 app[web.1]: at Object.<anonymous> (/app/models/dbServices.js:1:15)
2020-12-07T23:48:52.552390 00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:999:30)
2020-12-07T23:48:52.552390 00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
2020-12-07T23:48:52.552390 00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:863:32)
2020-12-07T23:48:52.552391 00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:708:14)
2020-12-07T23:48:52.552391 00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:887:19) {
2020-12-07T23:48:52.552392 00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-12-07T23:48:52.552392 00:00 app[web.1]: requireStack: [
2020-12-07T23:48:52.552392 00:00 app[web.1]: '/app/models/dbServices.js',
2020-12-07T23:48:52.552393 00:00 app[web.1]: '/app/models/delivery.models.js',
2020-12-07T23:48:52.552393 00:00 app[web.1]: '/app/controllers/delivery.controller.js',
2020-12-07T23:48:52.552393 00:00 app[web.1]: '/app/routes/delivery.routes.js',
2020-12-07T23:48:52.552394 00:00 app[web.1]: '/app/app.js'
2020-12-07T23:48:52.552394 00:00 app[web.1]: ]
2020-12-07T23:48:52.552394 00:00 app[web.1]: }
2020-12-07T23:48:52.640097 00:00 heroku[web.1]: Process exited with status 1
2020-12-07T23:48:52.691307 00:00 heroku[web.1]: State changed from starting to crashed
2020-12-07T23:48:52.695158 00:00 heroku[web.1]: State changed from crashed to starting
2020-12-07T23:48:55.954237 00:00 heroku[web.1]: Starting process with command `node app.js`
2020-12-07T23:48:59.617300 00:00 app[web.1]: internal/modules/cjs/loader.js:818
2020-12-07T23:48:59.617348 00:00 app[web.1]: throw err;
2020-12-07T23:48:59.617349 00:00 app[web.1]: ^
2020-12-07T23:48:59.617349 00:00 app[web.1]:
2020-12-07T23:48:59.617349 00:00 app[web.1]: Error: Cannot find module 'mysql'
2020-12-07T23:48:59.617350 00:00 app[web.1]: Require stack:
2020-12-07T23:48:59.617350 00:00 app[web.1]: - /app/models/dbServices.js
2020-12-07T23:48:59.617351 00:00 app[web.1]: - /app/models/delivery.models.js
2020-12-07T23:48:59.617351 00:00 app[web.1]: - /app/controllers/delivery.controller.js
2020-12-07T23:48:59.617351 00:00 app[web.1]: - /app/routes/delivery.routes.js
2020-12-07T23:48:59.617352 00:00 app[web.1]: - /app/app.js
2020-12-07T23:48:59.617359 00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
2020-12-07T23:48:59.617360 00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:667:27)
2020-12-07T23:48:59.617361 00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:887:19)
2020-12-07T23:48:59.617361 00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2020-12-07T23:48:59.617361 00:00 app[web.1]: at Object.<anonymous> (/app/models/dbServices.js:1:15)
2020-12-07T23:48:59.617361 00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:999:30)
2020-12-07T23:48:59.617362 00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
2020-12-07T23:48:59.617362 00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:863:32)
2020-12-07T23:48:59.617362 00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:708:14)
2020-12-07T23:48:59.617363 00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:887:19) {
2020-12-07T23:48:59.617363 00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-12-07T23:48:59.617363 00:00 app[web.1]: requireStack: [
2020-12-07T23:48:59.617364 00:00 app[web.1]: '/app/models/dbServices.js',
2020-12-07T23:48:59.617364 00:00 app[web.1]: '/app/models/delivery.models.js',
2020-12-07T23:48:59.617364 00:00 app[web.1]: '/app/controllers/delivery.controller.js',
2020-12-07T23:48:59.617365 00:00 app[web.1]: '/app/routes/delivery.routes.js',
2020-12-07T23:48:59.617365 00:00 app[web.1]: '/app/app.js'
2020-12-07T23:48:59.617365 00:00 app[web.1]: ]
2020-12-07T23:48:59.617366 00:00 app[web.1]: }
2020-12-07T23:48:59.710666 00:00 heroku[web.1]: Process exited with status 1
2020-12-07T23:48:59.780212 00:00 heroku[web.1]: State changed from starting to crashed
2020-12-07T23:49:05.437113 00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=brocoliserver.herokuapp.com request_id=53e2e783-b063-411e-abc7-a58a60a53b81 fwd="88.125.237.207" dyno= connect= service= status=503 bytes= protocol=https
2020-12-07T23:54:47.834773 00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=brocoliserver.herokuapp.com request_id=7f99c958-d7d1-4ea6-b1ae-4cd4483af6f1 fwd="88.125.237.207" dyno= connect= service= status=503 bytes= protocol=https
Пожалуйста, вы можете помочь мне это исправить? Я не понимаю, как это может работать с heroku run bash (что означает, что мои модули в порядке, мой порт тоже и т. Д.), Но не с heroku open command.
Ответ №1:
Я хочу умереть… Я всегда это делал git push heroku
, потому что по какой-то причине git push heroku master
мастер исходного кода не был определен… Я использую git push heroku main
, и это работает. Я сейчас так расстроен, лол