Ruby "bundle install" error on Openshift

I am fairly new to Ruby and the conditions for deploying the application through remote tools. I tried to deploy my application on a free openshift account. And I run the application.

When I run the application, I get this error:

You have already activated rack 1.5.2, but your Gemfile requires rack 1.6.0. Using bundle exec may solve this. (Gem::LoadError) 

So, I'm trying to run bundle exec , but I got another error:

 Gemfile syntax error: /var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/Gemfile:24: syntax error, unexpected ':', expecting $end gem 'sdoc', '~> 0.4.0', group: :doc 

I think it could be because I used Ruby 2.1.5 locally and Open shift runs Ruby 2.0 by default.

I came across this topic. How to get the package installed in OpenShift Online when my RAILS_ENV is configured for development? but I don’t know if I am doing it right. I don’t even know where to place this pre_build file. I tried putting it under /var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/.openshift/action_hooks/ . But I'm not sure if runtime is the right repo.

EDIT 1:

This is my Gemfile:

 source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.0' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.1.0' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates the API under doc/api. group: :doc do gem 'sdoc', '~> 0.4.0' end # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Unicorn as the app server # gem 'unicorn' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' # Access an IRB console on exception pages or by using <%= console %> in views gem 'web-console', '~> 2.0' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby] 

DECISION:

As @Rajarshi Das said, I had to change

 gem 'sdoc', '~> 0.4.0', group: :doc 

in

 group: :doc do gem 'sdoc', '~> 0.4.0' end 

I don’t know exactly why. There may be some syntax issues since I used Ruby 2.1.5 on the local computer and I had to use 2.0.0 for production. And after that I had to run gem install rails , although I quickly used rails. Finally, I had to manually add the gemfile gem 'nokogiri' . Finally, I could run bundle install and the application started to work.

+6
source share
4 answers

You can simply solve this error as follows

  group :doc do gem 'sdoc', '~> 0.4.0' end 

For platforms

 platforms :jruby, :mingw, :mswin do gem 'tzinfo-data' end 

Remove Gemfile.lock as You have already activated rack 1.5.2, but your Gemfile requires rack 1.6.0

Then check bundle install

+8
source

I ssh to $ app_root directory

gem install rack

he worked

+5
source

Make sure your branch is used for deployment

rhc app-configure --deployment-branch [BRANCH]

Then in your development environment update the stones

# bundle install

It will modify Gemfile.lock

$ git add -A $ git commit -am "Update gemfile" $ git push

Wait for the update to be updated.

0
source

I tried most of the solutions here, but I'm still stuck. The problem was installing the package for the currently used ruby ​​version. You will want to make the gem install bundler in app-root / runtime / repo. Then RAILS_ENV=production bundle exec rails console

You can refer to this answer

0
source

Source: https://habr.com/ru/post/982048/


All Articles