ruby 如何创建 gemfile / gemfile.lock

ahm*_*gül 1 ruby file heroku

我是业余编码员。我创建了一个 twitch 聊天机器人,现在正在尝试将其部署到 Heroku。我用没有 Rails 的 ruby​​ 编写了这段代码,我没有任何 gemfile 等。它在我的机器上工作正常,但我不知道如何为 Heroku 创建,我尝试了这样的操作,但遇到了这个错误:

Enumerating objects: 18, done.
Counting objects: 100% (18/18), done.
Delta compression using up to 16 threads
Compressing objects: 100% (14/14), done.
Writing objects: 100% (18/18), 4.87 KiB | 997.00 KiB/s, done.
Total 18 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/ruby.tgz
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to stormy-refuge-29575.
remote:
To https://git.heroku.com/stormy-refuge-29575.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/stormy-refuge-29575.git'
Run Code Online (Sandbox Code Playgroud)

github链接: https: //github.com/sydneyfunnelAIO/twitch-bot

小智 7

如果它是在红宝石中,你只需要这样做

bundle install
Run Code Online (Sandbox Code Playgroud)


jan*_*kan 6

您在应用程序中使用的所有 gem 都应该存在于Gemfile. 该应用程序在您的计算机上运行的原因可能是您全局安装了这些 gem。

因为您正在使用rufus-scheduler, selenium-webdrivergems,所以两者都应该出现在Gemfile, 中,应该如下所示:

source 'https://rubygems.org'

gem 'rufus-scheduler'
gem 'selenium-webdriver'
Run Code Online (Sandbox Code Playgroud)

一旦Gemfile存在,运行bundle install将安装 gem 并创建Gemfile.lock文件的命令。