I want to work on a supporting library while building an application while using RVM and Bundler to manage my application environment.
In my Gemfile is
# forked and cloned to local directory
gem 'feedzirra', :path => '../../feedzirra'
Then on command line:
$ bundle install
..
Using feedzirra (0.2.0.rc2) from source at /Users/ryan/dev/feedzirra
..
$ bundle show feedzirra
/Users/ryan/dev/feedzirra
$ gem which feedzirra
ERROR: Can't find ruby library file or shared library feedzirra
irb:
1.9.3p194 :001 > require 'feedzirra'
LoadError: cannot load such file -- feedzirra
from /Users/ryan/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/ryan/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from (irb):1
from /Users/ryan/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
What am I missing?
you need to run it in context of bundler:
bundle exec gem which feedzirra
or
bundle exec irb
Related
I want to require my gem. I create gemset, сhoose it. After create two files
.ruby-version and .ruby-gemset, next i do bundle init in Gemfile i write
gem 'codebreaker', git: 'https://github.com/somerepo', branch: 'development'
After this, bundle install. When i require 'codebreaker' - i take
<internal:/home/home/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- codebreaker (LoadError)
from <internal:/home/home/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from test.rb:1:in `<main>'
But when i do bundle info codebreaker, i see all description, which i do in gemspec
I tried running a gitproject , https://github.com/jmopr/job-hunter
in RubyMine IDE. And while running the project from menu in RubyMine IDE, the error produced is this.
--------------------------(START)-Output for run of project------------
/usr/bin/ruby /Applications/software/projects/gitprojects/job-hunter_rb/bin/rails server -b 0.0.0.0 -p 3000 -e development
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- bundler (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /Applications/software/projects/gitprojects/job-hunter_rb/bin/spring:8:in <top (required)>'
from /Applications/software/projects/gitprojects/job-hunter_rb/bin/rails:3:inload'
from /Applications/software/projects/gitprojects/job-hunter_rb/bin/rails:3:in `'
Process finished with exit code 1
--------------------------(END)-Output for run of project------------
Specs:
Ruby Version (ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin16] )
rails -v
Could not find proper version of railties (4.2.5.1) in any of the sources
Run bundle install to install missing gems.
Its seems you are missing the bundler gem which is the gem responsible for installing all other gems.
1) Install bundler first gem install bundler
2) Use bundler to install the other gems, so from the root directory of the project, run bundle install
Hopefully that should sort it out
I can install charlock_holmes gem on opensuse, trying to open it up in irb quickly, I get this:
> irb
2.3.0 :001 > require 'charlock_holmes'
LoadError: /home/wpostma/.rvm/gems/ruby-2.3.0/gems/charlock_holmes-0.7.3/lib/charlock_holmes/charlock_holmes.so:
undefined symbol: _ZTIN6icu_538ByteSinkE - /home/wpostma/.rvm/gems/ruby-2.3.0/gems/charlock_holmes-0.7.3/lib/charlock_holmes/charlock_holmes.so
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/wpostma/.rvm/gems/ruby-2.3.0/gems/charlock_holmes-0.7.3/lib/charlock_holmes.rb:1:in `<top (required)>'
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from (irb):1
from /home/wpostma/.rvm/rubies/ruby-2.3.0/bin/irb:11:in `<main>'
2.3.0 :002 >
It looks to me like maybe something in charlock_holmes is incompatible with the libicu version inside tumbleweed.
I'm using ruby installed with rvm, and purging all my gemsets and reinstalling does not fix it. Any other ways to get charlock_holmes to work? Maybe I need to install a special copy of libicu (earlier, older) and point the gem at it?
Either of these works. For me the bundle config option works better.
This is a direct command to install the gem, directing it towards the correct libicu version:
gem install charlock_holmes -- --with-icu-dir=/usr/local
This is a command to tell which ever ruby project I install later on this system, will get gems installed by bundler to just work instead of breaking:
bundle config build.charlock_holmes "--with-icu-dir=/usr/local" --global
Since I'm using rvm the above bundle configuration seems to be "global" to that rvm environment only.
In my case, the bundle config is helpful as a large series of actions that would have otherwise failed (installing gems, and bootstrapping a large rails application) just worked.
I added this line to my deploy.rb:
require 'bundler/capistrano'
and now I get this message when I run cap -T:
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- bundler/capistrano (LoadError)
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/loading.rb:152:in `require'
Here is some other relevant information:
dons-macbook:Gems don$ gem which bundler
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler.rb
dons-macbook:Gems don$ gem which capistrano
/usr/local/lib/ruby/gems/1.9.1/gems/capistrano-2.5.19/lib/capistrano.rb
dons-macbook:Gems don$ ruby --version
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
The output from cap -T says that it's running in Ruby 1.8, not 1.9 (look at the paths to the gems in the output). Check your PATH. Even better, use RVM to manage your Ruby versions and you won't get these kinds of problems.
So, I'm positive I once did a sudo bundle install out of desperation, which I now understand is a no-no. But now, when i try to run bundle install, I get the following error:
Installing culerity (0.2.12) /Library/Ruby/Site/1.8/rubygems/installer.rb:294:in `generate_bin': You don't have write permissions into the /Library/Ruby/Gems/1.8/bin directory. (Gem::FilePermissionError)
from /Library/Ruby/Site/1.8/rubygems/installer.rb:196:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/source.rb:100:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/installer.rb:55:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/spec_set.rb:12:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/spec_set.rb:12:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/installer.rb:44:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/installer.rb:8:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/cli.rb:217:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/vendor/thor/task.rb:22:in `send'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
I've tried removeing everything in ~/.bundle ~/.gem .bundle Gemfile.lock as well as any reference to culerity or capybara in /Library/Ruby (OSX 10.6). I also checked to make sure permissions were set correctly (not root) on all my files in this project. I also cleared the gem cache.
My Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.0.rc2'
# Bundle edge Rails instead:
#gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
gem 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri', '1.4.1'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for certain environments:
# gem 'rspec', :group => :test
# group :test do
# gem 'webrat'
# end
gem 'haml', '3.0.15'
gem 'mogli', '0.0.13' #, :path => "~/Sites/mogli"
gem 'facebooker2', '0.0.4'
gem 'geokit'
gem 'acts_as_restful_list'
gem 'hoptoad_notifier'
group :development, :test do
gem "rspec-rails", '2.0.0.beta.19'
gem 'factory_girl_rails'
gem 'capybara', '0.3.9'
gem 'database_cleaner'
gem 'cucumber-rails', '0.3.2'
gem 'cucumber', '0.8.5'
gem 'spork'
gem 'launchy' # So you can do Then show me the page
end
Also, I have rvm on my system, but I'm using the system ruby for this project.
Any ideas on what's causing the permission issue? Surely, I'm not stuck using sudo bundle install.
Thanks.
It look like you are using the system's ruby. You have a few options:
use sudo to install your bundle system wide. it could be a problem with conflicting gems from different applications.
use bundle install --path bundle_dir, which is going to install the gems in bundle_dir
use rvm (http://rvm.beginrescueend.com), this program will allow you to use different ruby versions, and different gem sets.
Try to touch a file in the particular path. I guess OS X is protecting these directories a bit more than just the normal way? I think OS X supports ACL's with their filesystem, maybe you have to look there?
maybe try using chmod on everything, but looks like you'll need to run it as sudo...not sure why that's not an option...