"missing required gems" error when creating the database - ruby-on-rails

When I run
$ sudo RAILS_ENV=production rake db:migrate
I get the following error:
missing these required gems:
rubytree >= 0
You're running:
ruby 1.8.7.249 at /usr/bin/ruby1.8
rubygems 1.8.15 at /usr/lib/ruby/gems/1.8, /home/venkat/.gem/ruby/1.8
Run rake gems:install to install the missing gems.
venkat#ubuntu:/var/redmine$ sudo vi config/database.yml
When I try to install the rubytree gem I get the following error:
gem install rubytree --version ">= 0" ERROR: While generating documentation for rubytree-0.8.2 ... MESSAGE: exit ... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/rubytree-0.8.2/ri --files COPYING,API-CHANGES --title Rubytree Documentation --quiet lib History.txt Manifest.txt COPYING API-CHANGES --title rubytree-0.8.2 Documentation --quiet

There's a problem with redmine and the versions of ruby/rubygems. It doesn't detect rubytree, even though it is already installed or exists in vendor directory. See redmine issues #9815 and #9798.
You can fix this by updating redmine to the current trunk or by making the changes from revision 8214.

Related

Migration failed on upgrade Bitnami Redmine

I did upgrade my Redmine (version 4.1.0) to last version (4.1.1.7) through THIS instruction.
All was ok until i wanted to migrate database. Once i entered sudo ruby bin/rake db:migrate RAILS_ENV=production' command the following error occured :
Activating bundler (~> 2.1)
Could not find 'bundler' (~> 2.1) among 5 total gem(s)
To install the version of bundler this project requires, run gem install bundler -v '~> 2.1'
Then i try gem install bundler -v '~> 2.1' :
Fetching: bundler-2.2.5.gem (100%)
Successfully installed bundler-2.2.5
Parsing documentation for bundler-2.2.5
Installing ri documentation for bundler-2.2.5
Done installing documentation for bundler after 46 seconds
Done installing documentation for bundler after 46 seconds
and ran sudo ruby bin/rake db:migrate RAILS_ENV=production again but same error occured.
My platform is Centos 7
Thanks
Bitnami Engineer here.
Please remember to load the Bitnami Environment before running any command in the installation. This way, you will ensure that you use the correct binaries when performing the operations.
You can run these commands to load the Bitnami Environment
cd INSTALLDIR
./use_redmine
https://docs.bitnami.com/installer/how-to/understand-bnconsole/
Once you do that, you can start to follow the steps in our guide to upgrade the app.
My problem is solved with help of THIS.
I use bundle exec rake db:migrate RAILS_ENV=production instead of sudo ruby bin/rake db:migrate RAILS_ENV=production.

bundler: Using a custom path while using system gems is unsupported

I am using GitLab-CI/CD to build my Rails application. I have noticed my builds are failing due to Using a custom path while using system gems is unsupported error, which were working perfectly fine before.
Tried to check newer update releases but didn't find any issues. Does any one have any idea on recent updates or somthing on mentioned issue?
Bellow is my gitlab-ci.yml
variables:
GIT_SUBMODULE_STRATEGY: recursive
cache:
key: ${CI_JOB_NAME}
paths:
- vendor/ruby
before_script:
- apt-get update -qq
- ruby -v
- which ruby
- gem --version
- git --version
- gem update --system 2.7.6
- gem install bundler -v 2.0.1
- bundle -v
- bundle config ${REPO_URL} ${BUNDLE_GITLAB__TOKEN}
- bundle config --global disable_shared_gems true
- bundle install --jobs $(nproc) "${FLAGS[#]}" --path vendor
rubocop:
tags:
- rubocop
script:
- bundle exec rubocop
# rspec:
# stage: test
# script:
# - bundle exec rspec
And bellow is the brief error I'm getting
$ apt-get update -qq
$ ruby -v
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]
$ which ruby
/usr/local/bin/ruby
$ gem --version
3.0.3
$ git --version
git version 2.20.1
$ gem update --system 2.7.6
Updating rubygems-update
Successfully installed rubygems-update-2.7.6
Installing RubyGems 2.7.6
Bundler 1.16.1 installed
RubyGems 2.7.6 installed
Regenerating binstubs
------------------------------------------------------------------------------
RubyGems installed the following executables:
/usr/local/bin/gem
/usr/local/bin/bundle
RubyGems system software updated
$ gem install bundler -v 2.0.1
Successfully installed bundler-2.0.1
1 gem installed
$ bundle -v
Bundler version 2.0.1
$ bundle config https://gitlab.com/dharshannn/test-star.git ${BUNDLE_GITLAB__TOKEN}
$ bundle config --global disable_shared_gems true
$ bundle install --jobs $(nproc) "${FLAGS[#]}" --path vendor
Using a custom path while using system gems is unsupported.
path:
Set for your local app (/usr/local/bundle/config): "vendor"
path.system:
Set via BUNDLE_PATH__SYSTEM: true
disable_shared_gems:
Set for the current user (/root/.bundle/config): true
ERROR: Job failed: exit code 1
The same happened to me today. I am pretty sure that there was no update to bundler or gem. The Docker image however has been updated (I was using ruby:2.6.3). I also added a new dependency when this started happening, so I suspect it was dependent on a gem which was already installed in the system path thus the error message.
You can get around it by specifying the following configuration variables in your .gitlab-ci.yml:
variables:
BUNDLE_DISABLE_SHARED_GEMS: "true"
BUNDLE_PATH__SYSTEM: "false"
This will configure Bundler to not use shared gems and disable system gems fully.
See https://bundler.io/v2.0/bundle_config.html
disable_shared_gems (BUNDLE_DISABLE_SHARED_GEMS): Stop Bundler from accessing gems installed to RubyGems' normal location.
and
path.system (BUNDLE_PATH__SYSTEM): Whether Bundler will install gems into the default system path (Gem.dir).

rails won't execute for newly created app

I'm struggling to get going with rails, so apologies for being a n00b. I've installed and uninstalled Ruby and all of my gems several times now and am still having problems getting rails to launch. If I do...
$ rails new sample_app
...
$ cd sample_app
...
$ bundle install
...
$ rails s
Could not find rake-10.5.0 in any of the sources
Run `bundle install` to install missing gems.
$ gem install rake -v 10.5.0
Successfully installed rake-10.5.0
Parsing documentation for rake-10.5.0
Installing ri documentation for rake-10.5.0
Done installing documentation for rake after 0 seconds
1 gem installed
$ rails s
Could not find rake-10.5.0 in any of the sources
Run `bundle install` to install missing gems.
$ rails --version
Could not find rake-10.5.0 in any of the sources
Run `bundle install` to install missing gems.
When I do gem list I see rake 10.5 is installed. I'm running Ruby 2.3.0 that I installed using rbenv. Running bundle install or bundle update as it indicates doesn't help. Suggestions?
I encountered that error before, sometimes it needs to put
gem 'rake' to Gemfile, and run bundle install.
Try running
sudo apt-get update
sudo apt-get install rake

Rake Aborted Error - Can't install bundler - When install GitLab

I am trying to install gitLab server in my Virtual Machines, When I Execute the command: sudo -u git -H bundle install --deployment --without development test mysql aws, I got this:
Some gems seem to be missing from your vendor/cache directory.
Could not find rake-10.3.2 in any of the sources
And my gem source is:
root#ubuntu:/home/git/gitlab# gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/
https://rubygems.org/
When I run gem install rake-10.3.2, I got this:
ERROR: Could not find a valid gem 'rake-10.3.2' (>= 0) in any repository
How do I resolve this problem?
Try installing rake with this command
gem install rake -v 10.3.2
Do one thing. Delete your Gemfile.lock
and run the command:
bundle install

issues deploying Rails site

I am attempting to deploy a site on a commercial hosting service. (JustHost.com)
I am having the following issue running bundle
# bundle
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
sudo: unable to stat /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Gem::Exception: Cannot load gem at [/usr/lib64/ruby/gems/1.9.3/cache/rake-10.3.0.gem] in /home5/<username>/<sitename>
An error occurred while installing rake (10.3.0), and Bundler cannot continue.
Make sure that `gem install rake -v '10.3.0'` succeeds before bundling.
I am able to successfully run the gem install command:
# gem install rake -v '10.3.0'
Successfully installed rake-10.3.0
1 gem installed
Installing ri documentation for rake-10.3.0...
Installing RDoc documentation for rake-10.3.0...
But I get the same error re-running bundle. Furthermore, I don't think I was actually able to install rake - its location is not writable by me and the version is unchanged:
# which rake
/usr/bin/rake
# rake --version
rake, version 0.9.2.2
I also tried updating my Gemfile to use rake 0.9.2.2. but ran into the same issue:
# bundle
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
sudo: unable to stat /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Gem::Exception: Cannot load gem at [/usr/lib64/ruby/gems/1.9.3/cache/rake-0.9.2.2.gem] in /home5/<username>/<sitename>
An error occurred while installing rake (0.9.2.2), and Bundler cannot continue.
Make sure that `gem install rake -v '0.9.2.2'` succeeds before bundling.
Any help appreciated!
What I did to get around this was update the .bashrc file per the instructions here. I also had to setup a javascript runtime so I used gems rubyracer with execjs.

Resources