Heroku Node.js Discord.js机器人程序部署失败

时间:2018-09-11 14:09:27

标签: node.js heroku discord.js

我遇到了很多问题。我创建了一个本地git存储库,将推荐设置设置为adviced here,并将该漫游器使用的所有文件复制到该存储库中。然后,我添加了所有文件,提交了更改并将其推送到Heroku存储库中。但是没有GitHub存储库。我有一个很重要的原因不创建GitHub存储库,因为bot令牌位于配置JSON文件中,而这实际上是源代码的一部分。我不希望该令牌在公共场合可见。

但是,事情进展得并不顺利。 Heroku日志显示该应用程序崩溃,因为未设置入口点。我只能猜测服务器端的应用程序配置有错误,或者在传输文件时出错了。我可以以某种方式恢复该应用程序吗?还是我需要制作全新的应用程序并独立安装所有部件?

这是Heroku日志所说的:

2018-09-11T13:25:20.012914+00:00 heroku[web.1]: State changed from crashed to starting
2018-09-11T13:25:18.633506+00:00 app[api]: Deploy 338966c1 by user marpolda@gmail.com
2018-09-11T13:25:18.633506+00:00 app[api]: Release v7 created by user marpolda@gmail.com
2018-09-11T13:25:19.000000+00:00 app[api]: Build succeeded
2018-09-11T13:25:26.534154+00:00 heroku[web.1]: Starting process with command `npm start`
2018-09-11T13:25:29.260285+00:00 heroku[web.1]: State changed from starting to crashed
2018-09-11T13:25:29.262057+00:00 heroku[web.1]: State changed from crashed to starting
2018-09-11T13:25:29.246814+00:00 heroku[web.1]: Process exited with status 1
2018-09-11T13:25:29.146268+00:00 app[web.1]: npm ERR! missing script: start
2018-09-11T13:25:29.160586+00:00 app[web.1]:
2018-09-11T13:25:29.160933+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-09-11T13:25:29.161118+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2018-09-11T13_25_29_151Z-debug.log
2018-09-11T13:25:31.267503+00:00 heroku[web.1]: Starting process with command `npm start`
2018-09-11T13:25:33.607355+00:00 heroku[web.1]: Process exited with status 1
2018-09-11T13:25:33.617718+00:00 heroku[web.1]: State changed from starting to crashed
2018-09-11T13:25:33.549320+00:00 app[web.1]: npm ERR! missing script: start
2018-09-11T13:25:33.555176+00:00 app[web.1]:
2018-09-11T13:25:33.555439+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2018-09-11T13_25_33_550Z-debug.log
2018-09-11T13:25:33.555355+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-09-11T14:02:26.829754+00:00 heroku[web.1]: State changed from crashed to starting
2018-09-11T14:02:29.197832+00:00 heroku[web.1]: Starting process with command `npm start`
2018-09-11T14:02:32.177929+00:00 heroku[web.1]: Process exited with status 1
2018-09-11T14:02:32.191335+00:00 heroku[web.1]: State changed from starting to crashed
2018-09-11T14:02:32.092366+00:00 app[web.1]: npm ERR! missing script: start
2018-09-11T14:02:32.099124+00:00 app[web.1]:
2018-09-11T14:02:32.099383+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-09-11T14:02:32.099521+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2018-09-11T14_02_32_094Z-debug.log

我似乎找不到问题的根源。这是package.json

{
  "name": "notch",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "CZghost",
  "license": "ISC",
  "dependencies": {
    "discord.js": "^11.4.2"
  }
}

以及相应的package-lock.json

{
  "name": "notch",
  "version": "1.0.0",
  "lockfileVersion": 1,
  "requires": true,
  "dependencies": {
    "async-limiter": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
      "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg=="
    },
    "discord.js": {
      "version": "11.4.2",
      "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-11.4.2.tgz",
      "integrity": "sha512-MDwpu0lMFTjqomijDl1Ed9miMQe6kB4ifKdP28QZllmLv/HVOJXhatRgjS8urp/wBlOfx+qAYSXcdI5cKGYsfg==",
      "requires": {
        "long": "^4.0.0",
        "prism-media": "^0.0.3",
        "snekfetch": "^3.6.4",
        "tweetnacl": "^1.0.0",
        "ws": "^4.0.0"
      }
    },
    "long": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
      "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
    },
    "prism-media": {
      "version": "0.0.3",
      "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-0.0.3.tgz",
      "integrity": "sha512-c9KkNifSMU/iXT8FFTaBwBMr+rdVcN+H/uNv1o+CuFeTThNZNTOrQ+RgXA1yL/DeLk098duAeRPP3QNPNbhxYQ=="
    },
    "safe-buffer": {
      "version": "5.1.2",
      "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
      "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
    },
    "snekfetch": {
      "version": "3.6.4",
      "resolved": "https://registry.npmjs.org/snekfetch/-/snekfetch-3.6.4.tgz",
      "integrity": "sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw=="
    },
    "tweetnacl": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.0.tgz",
      "integrity": "sha1-cT2LgY2kIGh0C/aDhtBHnmb8ins="
    },
    "ws": {
      "version": "4.1.0",
      "resolved": "https://registry.npmjs.org/ws/-/ws-4.1.0.tgz",
      "integrity": "sha512-ZGh/8kF9rrRNffkLFV4AzhvooEclrOH0xaugmqGsIfFgOE/pIz4fMc4Ef+5HSQqTEug2S9JZIWDR47duDSLfaA==",
      "requires": {
        "async-limiter": "~1.0.0",
        "safe-buffer": "~5.1.0"
      }
    }
  }
}

1 个答案:

答案 0 :(得分:1)

上面写着2018-09-11T14:02:32.177929+00:00 heroku[web.1]: Process exited with status 1 2018-09-11T14:02:32.191335+00:00 heroku[web.1]: State changed from starting to crashed 2018-09-11T14:02:32.092366+00:00 app[web.1]: npm ERR! missing script: start
这意味着它正在package.json文件中寻找一个名为“ start”的脚本。通常,“开始”脚本仅表示“ node *file_name*”。
在您的package.json文件中,添加
"scripts": { "start": "node *your main app filename*", } 关于“重新安装所有内容”的问题呢,我不太了解。尝试添加我提到的脚本,将其提交给git,看看它是否可以解决问题。