When trying to update OpenSSL - I broke (seemingly) everything surrounding Ruby and Rails on my laptop. Even after uninstalling ruby and rails through gem uninstall
I was able to resolve this problem by simply running gem install rails
.
This problem occurred when I cloned a pre-existing Rails 4 app. I am using ruby-2.0.0-p317, and an RVM gemset specific to this app. I ran the initial bundle install
, but then could not run rails console
without getting the error.
After running gem install rails
, which used the cached copy in my app's gemset, the problem was resolved. Don't ask my why!
This came up for me after installing rails with Rails Composer. Seems like a problem with RVM selecting the ruby version, the trick was to simply navigate out and back into the folder.
$ cd ..
$ cd myapp
I fixed the problem by completely removing Rails, Ruby, and RVM altogether - then starting from scratch.
I don't remember all of the commands exactly, but it was something like:
sudo gem uninstall rails
sudo rvm remove 2.0
rvm implode
sudo chown -R drewwyatt: ~/.rvm/
rm -rf ~/.rvm
\curl -L https://get.rvm.io | bash -s stable --rails
rvm use 2.0
gem install rails
Try running bundle exec rails server
instead of just rails server
.
I was seeing this error because I had a conflicting version of the rails
gem installed globally.
Prefixing commands with bundle exec
ensures that you're using gems specified by your project's Gemfile.lock
.
Similar to @ncherro, I got this using ruby filename.rb. Running
bundle exec ruby filename.rb
works.