我在尝试部署我的应用程序时遇到问题,我设法将github存储库部署到vercel和heroku中,但是当我打开实时应用程序时,它只显示白屏。
我认为这与我的package.json或类似内容有关。
这是我的package.json:
{
"name": "marvel-searcher",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"client": "npm start --prefix react-client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"build": "run dev",
"server": "node server"
},
"author": "David Liendo",
"license": "ISC",
"dependencies": {
"axios": "^0.20.0",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"md5": "^2.3.0",
"concurrently": "^5.3.0",
"dotenv": "^8.2.0"
},
"devDependencies": {
"concurrently": "^5.3.0",
"dotenv": "^8.2.0",
"nodemon": "^2.0.4"
}
}
我的github存储库:https://github.com/DavLiendoProgramming/marvelHeroes 我的快捷链接:https://marvel-heroes-black.vercel.app/
请帮助:(
答案 0 :(得分:0)
将"server": "node server"
更改为"start": "node server"
,并在项目的根目录中为Heroku创建一个Procfile。
在您的Procfile
的第一行中,放入web: npm start
答案 1 :(得分:0)
您可以在 package.json
上将server":"node server
更改为start: node server
创建 Procfile 并将web: node server.js
粘贴到文件上
Heroku将自动运行您的服务器