【发布时间】:2021-11-25 08:45:55
【问题描述】:
我们将不胜感激。
我整天都在尝试部署到 Heroku。我在本地使用 Vite 进行开发,所以我想我也会尝试使用它进行部署。一切都在本地工作(当然),并且在我部署存储库时构建成功。但是,当我尝试查看我的应用时,我得到以下信息:
2021-10-05T02:12:13.493958+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-05T02:12:14.624236+00:00 app[web.1]: [heroku-exec] Starting
2021-10-05T02:12:14.834583+00:00 app[web.1]:
2021-10-05T02:12:14.834585+00:00 app[web.1]: > dashboard-frontend@0.0.0 start /app
2021-10-05T02:12:14.834585+00:00 app[web.1]: > vite
2021-10-05T02:12:14.834585+00:00 app[web.1]:
2021-10-05T02:12:15.759365+00:00 app[web.1]: Pre-bundling dependencies:
2021-10-05T02:12:15.759384+00:00 app[web.1]: vue
2021-10-05T02:12:15.759384+00:00 app[web.1]: vue-chart-3
2021-10-05T02:12:15.759385+00:00 app[web.1]: axios
2021-10-05T02:12:15.759389+00:00 app[web.1]: (this will be run only when your dependencies or config have changed)
2021-10-05T02:12:16.402419+00:00 app[web.1]:
2021-10-05T02:12:16.402429+00:00 app[web.1]: vite v2.5.5 dev server running at:
2021-10-05T02:12:16.402429+00:00 app[web.1]:
2021-10-05T02:12:16.402543+00:00 app[web.1]: > Local: http://localhost:3000/
2021-10-05T02:12:16.402578+00:00 app[web.1]: > Network: use `--host` to expose
2021-10-05T02:12:16.402610+00:00 app[web.1]:
2021-10-05T02:12:16.402611+00:00 app[web.1]: ready in 1529ms.
2021-10-05T02:12:16.402611+00:00 app[web.1]:
2021-10-05T02:12:16.000000+00:00 app[api]: Build succeeded
2021-10-05T02:13:14.120863+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-10-05T02:13:14.233876+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-10-05T02:13:14.376928+00:00 heroku[web.1]: Process exited with status 137
2021-10-05T02:13:14.423585+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-05T02:13:15.030060+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=indicatorsdashboardfrontend.herokuapp.com request_id=c9ad1cae-2b32-4e54-bab1-7919401af71c fwd="98.209.145.237" dyno= connect= service= status=503 bytes= protocol=https
我在这里读到一篇文章说我需要设置一些变量以便 Vite 能够正确安装,我相信我做到了:
NPM_CONFIG_PRODUCTION=false
NPM_CONFIG_LOGLEVEL=error
YARN_PRODUCTION=false
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
我的仓库可以在这里找到:https://github.com/kddove85/IndicatorDashboardFrontend
我认为重要的文件是 package.json 但我不确定。这里是:
{
"name": "dashboard-frontend",
"version": "0.0.0",
"scripts": {
"start": "vite",
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"dependencies": {
"@vue/cli": "^4.5.13",
"axios": "^0.21.4",
"chart.js": "^2.9.4",
"lodash": "^4.17.21",
"vue": "^3.2.6",
"vue-axios": "^3.3.6",
"vue-chart-3": "^0.5.8"
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.6.1",
"@vue/compiler-sfc": "^3.2.6",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^7.18.0",
"vite": "^2.5.4"
},
"engines": {
"node": "14.17.5",
"npm": "6.14.14"
}
}
我只是不确定我做错了什么。
【问题讨论】:
标签: node.js heroku deployment vite