简体   繁体   English

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

[英]Heroku Node.js Discord.js bot deployment failed

I've encountered quite a little bit issue. 我遇到了很多问题。 I've created a local git repositiory, set up recommended settings as adviced here , and copied all files used by the bot into that repository. 我创建了一个本地git存储库,按照此处的建议设置建议的设置,并将该机器人使用的所有文件复制到该存储库中。 Then I added all files, commited changes and pushed into Heroku repository. 然后,我添加了所有文件,提交了更改并将其推送到Heroku存储库中。 However without the GitHub repository. 但是没有GitHub存储库。 I have very important reason for not creating GitHub repository as the bot token is inside a configuration JSON file, which is actually part of the source code. 我有一个很重要的原因不创建GitHub存储库,因为bot令牌位于配置JSON文件中,而这实际上是源代码的一部分。 I do not want that token to become visible in public. 我不希望该令牌在公共场合可见。

However, things didn't quite end up well. 但是,事情并没有很好地结束。 The Heroku log says the app crashed because there was no entry point set. Heroku日志显示该应用程序崩溃,因为未设置入口点。 I can only guess that there was a mistake in app configuration on the server side, or made mistake while transporting files. 我只能猜测服务器端的应用程序配置有错误,或者在传输文件时出错了。 Can I recover the app somehow? 我可以以某种方式恢复该应用程序吗? Or do I need to make completely fresh new app and install all parts one by one independently? 还是我需要制作全新的应用程序并独立安装所有部件?

This is what Heroku log says: 这就是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

I can't seem to locate the root of the issue. 我似乎找不到问题的根源。 This is package.json : 这是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"
  }
}

And corresponding package-lock.json : 和相应的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"
      }
    }
  }
}

It says 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.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.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
Which means it's looking for a script named "start" in your package.json file. 这意味着它将在package.json文件中寻找一个名为“ start”的脚本。 Usually, a "start" script simply means " node *file_name* ". 通常,“开始”脚本仅表示“ node *file_name* ”。
In your package.json file, add 在您的package.json文件中,添加
"scripts": { "start": "node *your main app filename*", } What about your question of "Installing everything again", i don't quite understand. "scripts": { "start": "node *your main app filename*", }关于“重新安装所有内容”的问题呢,我不太了解。 Try adding the scripts i mentioned, commiting them to git and look if it'll solve the problem. 尝试添加我提到的脚本,将其提交给git,看看它是否可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM