0

Introduction:

  • I have an installation of gitlab on a local lxc container running ubuntu 13.10 - saucy.
  • I have installed RVM as a as a multi-user installation - in /usr/local/rvm
  • In order to run gitlab with RVM I have created a wrapper for the bundle command as specified here

  • The gitlab application is running correctly but I have a problem running rails generate function

The steps I followed :

  • $ sudo su git - to login as the git user
  • $ cd /home/git/gitlab
  • $ source /etc/profile/
  • $ rvm use gemset ruby-2.1.1@gitlab - a custom gemset I created
  • $ gem list - lists all the gems that appear in the Gemfile for gitlab, so I know I am on the right gemset
  • $ rails -v -> Rails 4.0.3
  • $ rails generate --help will output

    /usr/local/rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require': cannot load such file -- rb-inotify (LoadError)
    from /usr/local/rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /usr/local/rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
    from /usr/local/rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
    from /usr/local/rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
    from /usr/local/rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
    from /usr/local/rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
    from /home/git/gitlab/config/application.rb:6:in `<top (required)>'
    from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:43:in `require'
    from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:43:in `<top (required)>'
    from bin/rails:8:in `require'
    from bin/rails:8:in `<main>'
    

What I gathered from this output is that it is in some way trying to use the ruby-2.1.1@global gemset.

If I switch to that gemset $ rvm use gemset ruby-2.1.1@global, $ gem list will output

*** LOCAL GEMS ***

bigdecimal (1.2.4)
bundler (1.5.3)
bundler-unload (1.0.2)
executable-hooks (1.3.1)
gem-wrappers (1.2.4)
io-console (0.4.2)
json (1.8.1)
minitest (4.7.5)
psych (2.0.3)
rake (10.1.0)
rdoc (4.1.0)
rubygems-bundler (1.4.2)
rvm (1.11.3.9)
test-unit (2.1.1.0)

And if I run bundle install or the wrapper bundle install it says that all the gems are installed.

What am I missing here?

--------------------edit------------------

found a way to make it work

I followed the trouble shooting guide and tried RAILS_ENV=production bundle exec rails generate --help and it worked

Apparently as stated here in the last comment, rb-inotify is "marked as development dependency" therefore forcing the environment to be production, it won't try to use it

Community
  • 1
  • 1

2 Answers2

0

To resolve 'require': cannot load such file -- rb-inotify

You need to install rb-inotify gem. Use the below command to install it:

gem install rb-inotify
Kirti Thorat
  • 52,578
  • 9
  • 101
  • 108
0

Put this line in Gemfile

gem 'rb-inotify'

and give bundle install then please give gem list in terminal.

if it is there means to fix this problem require this gem in application.rb like,

require "rb-inotify"

this problem will solve.

Jenorish
  • 1,694
  • 14
  • 19
  • I added `require` "rb-inotify" in application.rb and now it gives a different error /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require': cannot load such file -- rb-inotify (LoadError) – Cristian Bordei Apr 22 '14 at 14:12
  • sure you are having `rb-inotify` gem in your gemset means your gemset not loading properly.instead of `rvm` please try http://stackoverflow.com/questions/15708916/use-rvmrc-or-ruby-version-file-to-set-a-project-gemset-with-rvm#answers – Jenorish Apr 23 '14 at 04:42