Heroky部署-错误:缺少必需标志

时间:2019-05-14 15:15:35

标签: heroku deployment

我正在尝试通过将GitHub帐户连接到Heroku来部署应用程序。

点击“部署分支”后,访问我的应用程序URL时出现“应用程序错误”。

在我的终端上运行“ heroku logs --tail”时,这是我的错误:

»错误:缺少必需的标志:

»-a,--app APP应用程序,针对它运行命令

»查看有关--help

的更多帮助

这是我的package.json文件:

{
  "name": "app name",
  "version": "1.0.0",
  "description": "App",
  "main": "server.js",
  "scripts": {
    "client-install": "npm install --prefix client",
    "start": "node server.js run",
    "server": "nodemon server.js",
    "client": "npm start --prefix client",
    "dev": "concurrently \"npm run server\" \"npm run client\"",
    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
  },
  "author": "Name",
  "license": "UNLICENSED",
  "dependencies": {
    "balanced-match": "^1.0.0",
    "bcryptjs": "^2.4.3",
    "body-parser": "^1.18.3",
    "concurrently": "^3.5.1",
    "connect-flash": "^0.1.1",
    "cors": "^2.8.4",
    "express": "^4.16.3",
    "express-jwt": "^5.3.1",
    "gravatar": "^1.6.0",
    "joi": "^14.3.1",
    "jsonwebtoken": "^8.2.2",
    "mongodb": "^3.0.10",
    "mongoose": "^5.1.4",
    "nodemailer": "^5.1.1",
    "nodemailer-sendgrid-transport": "^0.2.0",
    "passport": "^0.4.0",
    "passport-jwt": "^4.0.0",
    "react-favicon": "0.0.14",
    "react-meta-tags": "^0.4.2",
    "rootpath": "^0.1.2",
    "sequelize": "^4.43.0",
    "validator": "^10.3.0"
  },
  "devDependencies": {
    "nodemon": "^1.17.5"
  }
}

因为我将代码直接从GitHub推送到Heroku应用程序,所以我真的不明白为什么我必须包含应用程序名称。

2 个答案:

答案 0 :(得分:0)

你是对的克里斯,heroku logs --tail --app yourappname很好。查看错误日志后,导入了我的一个节点模块,但拼写错误。

答案 1 :(得分:0)

您需要像这样将git remote设置为您的应用程序

heroku git:remote -a your_app_name