【问题标题】:Heroku node.js app not compatible with buildpackHeroku node.js 应用程序与 buildpack 不兼容
【发布时间】:2018-01-22 05:39:14
【问题描述】:

我今天尝试将我的 discord 机器人上传到 heroku,但每次我使用 git push heroku master 时都会出现以下错误:

remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> App not compatible with buildpack: https://codon-
buildpacks.s3.amazonaws.com/buildpacks/heroku/nodejs.tg
remote:        More info: 
https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to sjak-bot.
remote:
To https://git.heroku.com/sjak-bot.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/sjak-bot.git'

我已经做了heroku buildpacks:set heroku/nodejs,将node.js和npm版本添加到package.json中,但仍然报同样的错误。

这个机器人是用javascript编写的

【问题讨论】:

  • 你创建了 Procfile 了吗?
  • 您的 package.json 文件是否在存储库的根目录中?
  • 是的,我有一个 Procfile,这是其中的代码:web: node index.js,是的,package.json 位于存储库的根目录中。
  • 你成功了吗?我收到相同的消息,但在 heroku 文档或网络上的任何地方都找不到此错误。
  • 我忘记创建package.json,所以我输入了npm init 并创建了一个,它已修复。

标签: javascript node.js git heroku discord


【解决方案1】:

您应该将index.js 文件添加到您的主目录,在我的情况下,我只是添加了index.php 文件

【讨论】:

    猜你喜欢
    • 2018-02-16
    • 1970-01-01
    • 2020-10-03
    • 2021-11-12
    • 1970-01-01
    • 1970-01-01
    • 2019-02-05
    相关资源
    最近更新 更多