【发布时间】:2023-04-03 10:12:01
【问题描述】:
我在“gemz”文件夹中创建了一个简单的自定义 gem,并在 gemfile 中进行了配置(“checkpercentage”,“~>0.1.0”),它在我的应用程序中运行良好,但无法将其部署到 heroku。
我在尝试将更新推送到 Heroku 的主分支时遇到以下错误。
我的 Ruby 版本: ruby 2.1.1p76 (2014-02-24 修订版 45161) [i686-linux]
错误:
nci@nci-VirtualBox:~/Zacchi/kuizu$ git push heroku master
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.0.0
remote: -----> Installing dependencies using 1.7.12
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote: You have added to the Gemfile:
remote: * source: source at /home/nci/Zacchi/kuizu/gemz
remote: You have deleted from the Gemfile:
remote: * source: source at gemz
remote: Bundler Output: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote:
remote: You have added to the Gemfile:
remote: * source: source at /home/nci/Zacchi/kuizu/gemz
remote:
remote: You have deleted from the Gemfile:
remote: * source: source at gemz
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to safe-waters-3501.
remote:
宝石文件:
source 'https://rubygems.org'
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'devise'
gem 'checkpercentage', '~>0.1.0', :path => "/home/nci/Zacchi/kuizu/gemz"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
.... more gems ...
这些是我试图解决这个问题但到目前为止没有运气的东西:
- 捆绑安装
- 捆绑安装--部署
- 重命名 gemfile.lock 然后重新运行 bundle install
感谢任何帮助!
【问题讨论】:
-
在您的本地机器上,删除 Gemfile.lock,然后运行 bundle install,将新的 Gemfile.lock 提交到您的存储库中
-
我已经尝试过@cristian。发生同样的错误。这与我创建的本地自定义 gem 有什么关系吗?
-
@VictorAngelo 如果它解决了您的问题,请不要忘记接受答案,如果没有,请告诉我们您的进度。 :)
-
非常感谢 sbkomianos,我现在才有机会测试它。谢谢这解决了我的问题。 =)
标签: ruby-on-rails ruby heroku