gpt4 book ai didi

node.js - vue-cli-service : not found proplem on heroku? 如何解决

转载 作者:行者123 更新时间:2023-12-03 12:12:09 25 4
gpt4 key购买 nike

我在尝试部署名为 tr3 的应用程序时遇到问题(它在本地主机上运行良好,而且我还学会了使用 heroku 部署“测试应用程序”,一切都很好)。
但是现在,当我使用命令时

git push heroku master

有一条消息

remote: -----> Compressing...
remote: Done: 22.2M
remote: -----> Launching...
remote: Released v8
remote: https://stark-oasis-45806.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/stark-oasis-45806.git
12055ef..fbc5e05 master -> master

但是链接 https://stark-oasis-45806.herokuapp.com/导致错误
020-06-19T17:42:19.575287+00:00 app[web.1]: > tr3@0.1.0 start /app
2020-06-19T17:42:19.575288+00:00 app[web.1]: > npm run serve
2020-06-19T17:42:19.575288+00:00 app[web.1]:
2020-06-19T17:42:20.037740+00:00 app[web.1]:
2020-06-19T17:42:20.037766+00:00 app[web.1]: > tr3@0.1.0 serve /app
2020-06-19T17:42:20.037767+00:00 app[web.1]: > vue-cli-service serve
2020-06-19T17:42:20.037767+00:00 app[web.1]:
2020-06-19T17:42:20.045068+00:00 app[web.1]: sh: 1: vue-cli-service: not found
2020-06-19T17:42:20.049281+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-06-19T17:42:20.049568+00:00 app[web.1]: npm ERR! syscall spawn
2020-06-19T17:42:20.049812+00:00 app[web.1]: npm ERR! file sh

这里也是我的 package.json
{
"engines": {
"node": "10.x"
},
"name": "tr3",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"start": "npm run serve",
"heroku-postinstall": "npm install && npm run build"
},
"heroku-postinstall": "npm install && npm run build",
"dependencies": {
"core-js": "^3.6.5",
"vue": "^2.6.11",
"vue-router": "^3.3.4",
"vuex": "^3.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.4.0",
"@vue/cli-plugin-eslint": "~4.4.0",
"@vue/cli-service": "~4.4.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

最佳答案

几天前我遇到了同样的问题,我是 Vue.js 和 Heroku 的新手,但我能够找到帮助我解决问题的信息,我希望它可以帮助其他人。
在 package.json 的同级创建 static.json 文件:

{
"root": "dist",
"clean_urls": true,
"routes": {
"/**": "index.html"
}
}
将 static.json 文件添加到 git
git add static.json
git commit -m "add static configuration"
部署到 Heroku
heroku buildpacks:add heroku/nodejs
heroku buildpacks:add https://github.com/heroku/heroku-buildpack-static
git push heroku master
信息来源: Deployment | Vue CLI

关于node.js - vue-cli-service : not found proplem on heroku? 如何解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62476176/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com