【发布时间】:2021-04-03 00:12:24
【问题描述】:
我尝试在heroku 上上传一个 MERN 堆栈项目,当我推送我的项目时没有显示任何错误,但之后当我尝试打开我的应用程序时显示如下错误:
然后当我在heroku logs 上看到这样的错误时:
2021-04-02T04:39:53.640765+00:00 app[web.1]: }
2021-04-02T04:39:53.673306+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-04-02T04:39:53.673901+00:00 app[web.1]: npm ERR! errno 1
2021-04-02T04:39:53.688128+00:00 app[web.1]: npm ERR! react-boiler-plate@1.0.0 start: `node server/index.js`
2021-04-02T04:39:53.688366+00:00 app[web.1]: npm ERR! Exit status 1
2021-04-02T04:39:53.688645+00:00 app[web.1]: npm ERR!
2021-04-02T04:39:53.688864+00:00 app[web.1]: npm ERR! Failed at the react-boiler-plate@1.0.0 start script.
2021-04-02T04:39:53.689072+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-04-02T04:39:53.702373+00:00 app[web.1]:
2021-04-02T04:39:53.702750+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-04-02T04:39:53.702956+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-04-02T04_39_53_691Z-debug.log
2021-04-02T04:39:53.801523+00:00 heroku[web.1]: Process exited with status 1
2021-04-02T04:39:57.606025+00:00 app[web.1]:
2021-04-02T04:39:57.606043+00:00 app[web.1]: > react-boiler-plate@1.0.0 start /app
2021-04-02T04:39:57.606044+00:00 app[web.1]: > node server/index.js
2021-04-02T04:39:57.606044+00:00 app[web.1]:
2021-04-02T04:39:59.617643+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2021-04-02T04:39:59.617704+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-04-02T04:39:59.618588+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2021-04-02T04:39:59.618717+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2021-04-02T04:39:59.618853+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2021-04-02T04:39:59.619452+00:00 app[web.1]: Server Listening on 52400
2021-04-02T04:39:59.664202+00:00 heroku[web.1]: State changed from starting to up
2021-04-02T04:40:00.154607+00:00 app[web.1]: MongoDB Connected...
2021-04-02T04:40:02.562719+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=482fc0ad-4dbf-4d68-a0b8-4ad915f0356d fwd="116.58.200.211" dyno=web.1 connect=0ms service=81ms status=404 bytes=412 protocol=https
2021-04-02T04:40:02.564414+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:40:12.580732+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=0cb0a90a-eefe-4730-97f2-58ad7601fb31 fwd="116.58.200.211" dyno=web.1 connect=0ms service=11ms status=404 bytes=412 protocol=https
2021-04-02T04:40:12.581974+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:41:07.703010+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=5195792b-17a0-4044-82a6-8e392f3bc920 fwd="116.58.200.211" dyno=web.1 connect=0ms service=13ms status=404 bytes=412 protocol=https
2021-04-02T04:41:07.703565+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:43:56.612829+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:43:56.614507+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=24d996e4-a43f-427c-89d5-a83fad29ec8e fwd="116.58.200.211" dyno=web.1 connect=2ms service=15ms status=404 bytes=412 protocol=https
2021-04-02T04:47:24.095734+00:00 app[api]: Set NODE_ENV config vars by user alaminsheikh30025@gmail.com
2021-04-02T04:47:24.095734+00:00 app[api]: Release v7 created by user alaminsheikh30025@gmail.com
2021-04-02T04:47:24.300332+00:00 heroku[web.1]: Restarting
2021-04-02T04:47:24.302570+00:00 heroku[web.1]: State changed from up to starting
2021-04-02T04:47:26.081387+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-04-02T04:47:26.273408+00:00 heroku[web.1]: Process exited with status 143
2021-04-02T04:47:28.480334+00:00 heroku[web.1]: Starting process with command `npm start`
2021-04-02T04:47:32.050957+00:00 app[web.1]:
2021-04-02T04:47:32.050999+00:00 app[web.1]: > react-boiler-plate@1.0.0 start /app
2021-04-02T04:47:32.051000+00:00 app[web.1]: > node server/index.js
2021-04-02T04:47:32.051001+00:00 app[web.1]:
2021-04-02T04:47:33.084385+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2021-04-02T04:47:33.084397+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-04-02T04:47:33.085117+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2021-04-02T04:47:33.085232+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2021-04-02T04:47:33.085334+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2021-04-02T04:47:33.085964+00:00 app[web.1]: Server Listening on 8465
2021-04-02T04:47:33.331113+00:00 app[web.1]: MongoDB Connected...
2021-04-02T04:47:33.388190+00:00 heroku[web.1]: State changed from starting to up
2021-04-02T04:47:34.346673+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=183fcfe3-db55-4a00-b385-9d7d66f60ed4 fwd="116.58.200.211" dyno=web.1 connect=1ms service=24ms status=404 bytes=412 protocol=https
2021-04-02T04:47:34.348398+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:48:45.968962+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=2a1df37e-9697-4cf4-be41-cc907f6cb724 fwd="116.58.200.211" dyno=web.1 connect=0ms service=16ms status=404 bytes=412 protocol=https
2021-04-02T04:48:45.969496+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:55:29.405371+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:55:29.405889+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=b9b8b037-8c4a-4c58-9fc9-d116af2283e9 fwd="116.58.200.211" dyno=web.1 connect=0ms service=10ms status=404 bytes=412 protocol=https
2021-04-02T05:02:01.000000+00:00 app[api]: Build started by user alaminsheikh30025@gmail.com
2021-04-02T05:02:35.128829+00:00 app[api]: Deploy 7dd2269f by user alaminsheikh30025@gmail.com
2021-04-02T05:02:35.128829+00:00 app[api]: Release v8 created by user alaminsheikh30025@gmail.com
2021-04-02T05:02:35.313075+00:00 heroku[web.1]: Restarting
2021-04-02T05:02:35.315983+00:00 heroku[web.1]: State changed from up to starting
2021-04-02T05:02:36.000000+00:00 app[api]: Build succeeded
2021-04-02T05:02:36.713360+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-04-02T05:02:36.983404+00:00 heroku[web.1]: Process exited with status 143
2021-04-02T05:02:39.085257+00:00 heroku[web.1]: Starting process with command `npm start`
2021-04-02T05:02:42.325482+00:00 app[web.1]:
2021-04-02T05:02:42.326048+00:00 app[web.1]: > react-boiler-plate@1.0.0 start /app
2021-04-02T05:02:42.326051+00:00 app[web.1]: > node server/index.js
2021-04-02T05:02:42.326053+00:00 app[web.1]:
2021-04-02T05:02:43.565518+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2021-04-02T05:02:43.565529+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-04-02T05:02:43.566549+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2021-04-02T05:02:43.566660+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2021-04-02T05:02:43.566774+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2021-04-02T05:02:43.567285+00:00 app[web.1]: Server Listening on 58335
2021-04-02T05:02:43.757613+00:00 app[web.1]: MongoDB Connected...
2021-04-02T05:02:43.923407+00:00 heroku[web.1]: State changed from starting to up
2021-04-02T05:03:06.224704+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=0dfe3e56-29e2-4abd-9326-30f22a3f3a3f fwd="116.58.200.211" dyno=web.1 connect=3ms service=24ms status=404 bytes=412 protocol=https
2021-04-02T05:03:06.226724+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T05:37:05.548583+00:00 heroku[web.1]: Idling
2021-04-02T05:37:05.550224+00:00 heroku[web.1]: State changed from up to down
2021-04-02T05:37:06.905027+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-04-02T05:37:07.188301+00:00 heroku[web.1]: Process exited with status 143
2021-04-02T05:45:52.000000+00:00 app[api]: Build started by user alaminsheikh30025@gmail.com
2021-04-02T05:46:24.941298+00:00 app[api]: Deploy 3d2e9eec by user alaminsheikh30025@gmail.com
2021-04-02T05:46:24.941298+00:00 app[api]: Release v9 created by user alaminsheikh30025@gmail.com
2021-04-02T05:46:25.895329+00:00 heroku[web.1]: State changed from down to starting
2021-04-02T05:46:26.000000+00:00 app[api]: Build succeeded
2021-04-02T05:46:29.859262+00:00 heroku[web.1]: Starting process with command `node index.js`
2021-04-02T05:46:33.688119+00:00 app[web.1]: (node:4) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2021-04-02T05:46:33.688136+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-04-02T05:46:33.688805+00:00 app[web.1]: (node:4) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2021-04-02T05:46:33.688950+00:00 app[web.1]: (node:4) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2021-04-02T05:46:33.689117+00:00 app[web.1]: (node:4) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2021-04-02T05:46:33.689750+00:00 app[web.1]: Server Listening on 3542
2021-04-02T05:46:33.946525+00:00 app[web.1]: MongoDB Connected...
2021-04-02T05:46:34.274995+00:00 heroku[web.1]: State changed from starting to up
2021-04-02T05:46:41.770270+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=c42834c5-a16c-4c12-ab34-41f2a229d0d6 fwd="116.58.200.211" dyno=web.1 connect=0ms service=48ms status=404 bytes=412 protocol=https
2021-04-02T05:46:41.775861+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
我有这样的配置文件:
.dev.js文件:
module.exports = {
mongoURI:
"mongodb+srv://username:pass@demo.erwyk.mongodb.net/PORTFOLIO?retryWrites=true&w=majority",
};
prod.js文件:
module.exports = {
mongoURI: process.env.MONGO_URI,
};
key.js文件:
if (process.env.NODE_ENV === 'production') {
module.exports = require('./prod');
} else {
module.exports = require('./dev');
}
然后我在heroku上添加了配置文件:
任何建议请。
【问题讨论】:
-
我的问题已经解决了
-
好的,你能发布一个详细的答案来解释你如何解决你的问题吗?
标签: javascript node.js reactjs git heroku