I was having problems of the form:
/usr/local/share/gems/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
when trying to run a rails app as root, after running bundle install as root.
An article at http://www.petersens.ws/2012/08/ruby-on-rails-and-sqlite3 helped me figure out the problem. Some of the apps with native extensions don't set GEM_HOME properly as root. The easiest way to fix this is to run gem uninstall on the offending gem, then run the bundle install as a regular user. I also ran into this with
posix_spawn (/usr/local/share/gems/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:2:in `require': cannot load such file -- posix_spawn_ext (LoadError))
charlock_holmes (/usr/local/share/gems/gems/charlock_holmes-0.6.9.1/lib/charlock_holmes.rb:1:in `require': cannot load such file -- charlock_holmes/charlock_holmes (LoadError))
yajl_ruby (/usr/local/share/gems/gems/yajl-ruby-1.1.0/lib/yajl.rb:1:in `require': cannot load such file -- yajl/yajl (LoadError))
redcarpet (/usr/local/share/gems/gems/redcarpet-2.2.2/lib/redcarpet.rb:1:in `require': cannot load such file -- redcarpet.so (LoadError))
nokogiri (/usr/local/share/gems/gems/nokogiri-1.5.6/lib/nokogiri.rb:27:in `require': cannot load such file -- nokogiri/nokogiri (LoadError))
In all cases, uninstalling the gem as root, then running bundle install as a regular user fixed it.
Thursday, April 18, 2013
Bundler, Rails, and root
Labels:
bundler,
charlock_holmes,
nokogiri,
posix_spawn,
rails,
redcarpet,
sqlite3_native,
yajl_ruby
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment