Reputation:
I've cloned my app from Github but I've got errors on Gemfile. So I think, this app. is still running on heroku and it said that all up to date when I've used following commands:
git status
//On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
git push heroku
//Everything up-to-date
Also I could see output in heroku. How to fix the error in Gemfile? thanks.
//error as below:
There was an error parsing `Gemfile`: The `branch` option for `gem 'recaptcha'` is not allowed. Only gems with a git source can specify a branch. Bundler cannot continue.
# from /home/ubuntu/workspace/typo-1/Gemfile:46
# -------------------------------------------
# gem 'acts_as_tree_rails3'
> gem 'recaptcha', :require => 'recaptcha/rails', :branch => 'rails3'
#
//Gemfile
env = ENV["RAILS_ENV"] || 'development'
dbfile = File.expand_path("../config/database.yml", __FILE__)
#unless File.exists?(dbfile)
# raise "You need to configure config/database.yml first"
#else
# conf = YAML.load(File.read(dbfile))
# adapter = conf[env]['adapter']
# raise "You need define an adapter in your database.yml" if adapter == '' || adapter.nil?
# case adapter
# when 'sqlite3'
# gem 'sqlite3'
# when 'postgresql'
# gem 'pg'
# when 'mysql'
# gem 'sam-mysql-ruby'
# else
# raise "Don't know what gem to use for adapter #{adapter}"
# end
#end
group :production do
gem 'pg'
end
source 'https://rubygems.org'
ruby "1.9.3"
gem 'thin'
gem 'rails', '~> 3.0.10'
gem 'require_relative'
gem 'htmlentities'
gem 'json'
gem 'bluecloth', '~> 2.1'
gem 'coderay', '~> 0.9'
gem 'kaminari'
gem 'RedCloth', '~> 4.2.8'
gem 'addressable', '~> 2.1', :require => 'addressable/uri'
gem 'mini_magick', '~> 1.3.3', :require => 'mini_magick'
gem 'uuidtools', '~> 2.1.1'
gem 'flickraw-cached'
gem 'rubypants', '~> 0.2.0'
gem 'rake', '~> 0.9.2'
gem 'acts_as_list'
gem 'acts_as_tree_rails3'
gem 'recaptcha', :require => 'recaptcha/rails', :branch => 'rails3'
group :development, :test do
gem 'ruby-debug19'
gem 'factory_girl', '~> 2.2'
gem 'webrat'
gem 'rspec-rails', '~> 2.0'
gem 'simplecov', :require => false
gem 'sqlite3'
gem 'cucumber'
gem 'cucumber-rails', :require => false
gem 'cucumber-rails-training-wheels'
gem 'database_cleaner'
gem 'capybara'
end
//edited I took off branch but got error as below when run bundle install: bundle install
"Your Ruby version is 2.3.0, but your Gemfile specified 1.9.3"
Version 2.4 create the same error. So,I've changed to 2.3.0 - it went through until another error as below:
Results logged to /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/json-1.7.5/gem_make.out
An error occurred while installing json (1.7.5), and Bundler cannot continue.
Make sure that gem install json -v '1.7.5'
succeeds before bundling.
//editing
I've follow the answer suggested to use the old version 1.9.2 and I be able to use command bundle install but after pushing to heroku, I've got empty page on heroku and errors as below:
//errors
2017-07-23T18:09:50.995656+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/controllers/controller.rb:181:in `load_rackup_config'
2017-07-23T18:09:50.995657+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/controllers/controller.rb:71:in `start'
2017-07-23T18:09:50.995657+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/runner.rb:187:in `run_command'
2017-07-23T18:09:50.995658+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/runner.rb:152:in `run!'
2017-07-23T18:09:50.995659+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/bin/thin:6:in `<top (required)>'
2017-07-23T18:09:50.995659+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/bin/thin:23:in `load'
2017-07-23T18:09:50.995660+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/bin/thin:23:in `<top (required)>'
2017-07-23T18:09:51.185918+00:00 heroku[web.1]: Process exited with status 1
2017-07-23T18:09:51.200309+00:00 heroku[web.1]: State changed from starting to crashed
2017-07-23T18:09:51.845236+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=typoa.herokuapp.com request_id=7c8caa3e-8bad-4431-9da6-8ddf2f52a4d1 fwd="108.211.182.6" dyno= connect= service= status=503 bytes= protocol=https
2017-07-23T18:19:04.542770+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=typoa.herokuapp.com request_id=798e1c83-078a-4da6-b2cd-dfbf47b80687 fwd="108.211.182.6" dyno= connect= service= status=503 bytes= protocol=https
//edited
When I took off suggested line( with recaptcha), I could not see app. locally. With this line I could see app. locally.
Errors without this line as below:
rails server -b $IP -p $PORT
=> Booting WEBrick
=> Rails 3.0.17 application starting in development on http://0.0.0.0:8080
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
home/ubuntu/workspace/typo-1/config/initializers/recaptcha.rb:1:in `<top (required)>': uninitialized constant Recaptcha (NameError)
from /usr/local/rvm/gems/ruby-1.9.3-p551/gems/railties-3.0.17/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>'
In any cases, I could not push to heroku: Errors as below(it recommends to use the latest version of Ruby):
Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: !
remote: ! An error occurred while installing ruby-1.9.3
remote: !
remote: ! Heroku recommends you use the latest supported Ruby version listed here:
//edit I could not find a working app to see the solution of this problem...Error message as below: http://typosphere.org/stable.tar.gz#
Upvotes: 1
Views: 1708
Reputation: 46
1- In reCAPTCHA project on Github there is not a branch rails3, so, remove that piece of your Gemfile.
gem 'recaptcha', :require => 'recaptcha/rails'
2- Since you are using ruby 2.2.x, and in Gemfile is 1.9.3 I suggest that you should install 1.9.3 (via rvm or via rvm or whatever you use to manage your ruby versions) in your machine and work with that in order to avoid other conflicts you may find, because you are using a legacy code.
rvm install 1.9.3
rvm use 1.9.3
now install gem bundler and after that blundle install your Gemfile
Upvotes: 2
Reputation: 2575
I did not get this error using Ruby 2.4.1. I did get the same error when I changed versions to 1.9.3, as specified in the Gemfile. I also don't see a branch called rails3
at the source on Github. I would try removing the branch option first.
gem 'recaptcha', require: 'recaptcha/rails'
Upvotes: 0