【发布时间】:2021-04-13 04:08:38
【问题描述】:
我正在尝试将简单的 CRUD 节点 js API 部署到 heroku,但总是让应用程序崩溃 h10,
它在本地https://i.stack.imgur.com/56GNF.png 中工作。但是当我部署它时出现此错误https://i.stack.imgur.com/KbZzJ.png。
过程文件
web:node app.js
我已经尝试过web: node app.js、web: yarn start、web:yarn start,但仍然遇到同样的错误
Package.JSON
{
"name": "servis-invoice",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "nodemon app.js",
"start": "node app.js"
},
"dependencies": {
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"mongoose": "^5.11.18",
"mongoose-delete": "^0.5.3",
"nodemon": "^2.0.7"
}
}
我的配置变量:https://i.stack.imgur.com/K7f0K.jpg
我是否缺少任何步骤?
我正在使用 yarn,但我不知道为什么 heroku 在部署中使用 npm start?
【问题讨论】:
-
我的
Procfile看起来像这样:worker: node index.js。也许它对你有用