LoadErrors with specifically ruby 1.8.7 on OSX 10.7
This is on a clean install of OSX 10.7 Lion. Here's the actions I've taken:
I installed Xcode (4.1)
I installed RVM (1.8.0 ):
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
I installed ruby 1.8.7 and 1.9.2
rvm install 1.8.7
rvm install 1.9.2
I switch switch to 1.8.7
rvm use 1.8.7
I install a gem
gem install json
I use that gem in a ruby file.
require 'json'
I attempt to run that ruby file and get the following error:
main.rb.txt:1:in `re开发者_运维技巧quire': no such file to load -- json (LoadError)
I double check my gems:
gem list
..sure enough, it's installed.
*** LOCAL GEMS ***
json (1.5.4)
rack (1.3.2)
rake (0.9.2 ruby)
sinatra (1.2.6)
tilt (1.3.3)
This problem presents itself regardless of what gem I require. However, if I switch to 1.9.2, everything works fine.
I've uninstalled and reinstalled ruby 1.8.7 (along with every other version) with RVM. I've uninstalled and reinstalled gems with gem. What am I missing?
Additional information: Gem version: 1.8.6
Did you require rubygems first? You need to require that in order to activate the gem loader in your Ruby program:
require 'rubygems'
require 'json'
精彩评论