Every Rails command fails epically - ruby-on-rails

I recently ran into a problem and in desperation decided to uninstall and reinstall both Ruby and Rails on my OS X 10.6. I've reinstalled Ruby and gem installed rails. Now, though, I get this error or similar EVERY time I try to run a rails command (even -v):
rails -v
/Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.5/lib/bundler/spec_set.rb:90:in `block in materialize': Could not find bcrypt-ruby-3.0.1 in any of the sources (Bundler::GemNotFound)
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83:in `map!'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83:in `materialize'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.5/lib/bundler/definition.rb:127:in `specs'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p1
25#global/gems/bundler-1.1.5/lib/bundler/environment.rb:27:in `specs'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:41:in `candidate?'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:60:in `setup'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:75:in `<top (required)>'
from /Users/Dylan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /Users/Dylan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /Users/Dylan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125/bin/ruby_noexec_wrapper:9:in `<main>'
ANy ideas on how to fix this?

It seems like you need to install bcrypt-ruby
Maybe try sudo gem install bcrypt-ruby?

Run bundle install then run bundle exec rails -v see if this clears the issue.

Related

Passenger, RoR + Apache Bundler:Gemnotfound

I'm trying to set up my own VPS (Ubuntu 14.04), and have almost succeeded (I hope!).
I'm using passenger, Rails and Apache. When I browse to my IP, I get a bundle GemError, though when I run bundle install on my machine it tells me it's using all gems.
The problem first occurred with the json gem, which is the first gem. When I manually added "gem json, 1.8.3" to my Gemfile, the error went to the second gem of the list, minitest.
There are two weird messages on top which might be the problem, but I do not really understand those messages:
Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks --version 1.3.2
Ignoring gem-wrappers-1.2.7 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.2.7
Could not find minitest-5.6.1 in any of the sources (Bundler::GemNotFound)
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/spec_set.rb:92:in `block in materialize'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/spec_set.rb:85:in `map!'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/spec_set.rb:85:in `materialize'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/definition.rb:140:in `specs'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/definition.rb:185:in `specs_for'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/definition.rb:174:in `requested_specs'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/environment.rb:18:in `requested_specs'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runtime.rb:13:in `setup'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler.rb:127:in `setup'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/setup.rb:18:in `<top (required)>'
/usr/local/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:399:in `activate_gem'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:277:in `block in run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:404:in `running_bundler'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:276:in `run_load_path_setup_code'
/usr/share/passenger/helper-scripts/rack-preloader.rb:99:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:153:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'
Passenger author here. This error usually means one of two things:
Your app isn't being run as the user that it's supposed to be run as. Please set passenger_user to explicitly specify a user.
Your app isn't being run with the Ruby interpreter that it's supposed to be run as. Please set passenger_ruby to explicitly set a path to the Ruby interpreter that is supposed to be used.
If all fails, try our new end-to-end deployment walkthrough. It should work guaranteed (assuming you are starting from scratch and using the latest Passenger version).

Mac OSX 10.10 Yosemite - Rake aborted! LoadError: cannot load such file -- iconv

It seems that my ruby version auto updated to 2.0.0 after I upgraded my OSX to Yosemite.
It failed me when I tried to do
rake db:migrate
My application supports version 1.9.3 and I am uncertain that is the cause of such error.
$ rake db:migrate --trace
rake aborted! LoadError: cannot load such file -- iconv
/Users/jinqyu/Documents/Chocolicious/config/application.rb:5:in `require'
/Users/jinqyu/Documents/Chocolicious/config/application.rb:5:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/jinqyu/Documents/Chocolicious/Rakefile:4:in `<top (required)>'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/usr/bin/rake:37:in `<main>'
I found few links installing ruby 1.9.3 but I don't know which one to use.
I followed a guide from http://www.curvve.com/blog/guides/2013/install-ruby-1-9-3-mac-osx-10-8-macports-rvm/
However, I can't even run the first command
$sudo port selfupdate -v
after installing macPort. It says command not found.
Any ror warriors has the same problem as me and had solved it? Please help!
Downgraded ruby version to 1.9.3 and the app works fine! HOORAY!
So apparently the version is the cause of such error.
Here's the steps I took to resolve the error, open your terminal.
Install RVM with a Ruby, copy & paste:
$ \curl -sSL https://get.rvm.io | bash -s stable
$ rvm get head
Install Ruby
$ rvm use --install 1.9.3
Bundle install & rake:db
$ bundle install
$ rake db:migrate
Tell me if it solves your problem. I might missed out some steps after trying many other solutions that I found online.
p/s: you might have to install homebrew beforehand. cheers! :)
source: https://github.com/wayneeseguin/rvm/issues/3099
In order to resolve it, please add the following gem in the gem file, it would help you from being downgraded.
gem "iconv", "~> 1.0.3"

rails console on openshift

I deployed my rails application to openshift it works well but I cannot run 'rails console' on production server. It gives me this error. How can I solve this? I tried to update rubygems but it also gives permission denied error and I couldn't make it too.
rails c error:
Warning: You're using Rubygems 1.8.24 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require': cannot load such file -- bundler/setup (LoadError)
from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/commands.rb:33:in `<module:Spring>'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/commands.rb:4:in `<top (required)>'
from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:77:in `preload'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:140:in `serve'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:122:in `run'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>'
from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
from -e:1:in `<main>'
rubygems-update error:
[appname.rhcloud.com repo]\> update_rubygems
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /opt/rh/ruby193/root/usr/local/share/ruby
I ran into the same issue, try running it like this:
RAILS_ENV=production bundle exec rails console
Also make sure you are running it in ~/app-root/repo when you run it
To update rubygems:
gem update --system
If that doesn't solve the problem try Spring's suggestion and run:
gem pristine --all
The problem is that there are multiple bundle executables and the system is using the wrong one.
Locate the correct bundle executable. In my case it was located at ~/.gem/bin/bundle.
If you can't find it, install it gem install bundler.
Then run ~/.gem/bin/bundle exec rails console production inside ~/app-root/repo
I couldn't get any of the gem install or bundle exec solutions to work while running the 4.1.4 Rails cartridge on OpenShift. My solution was running RAILS_ENV=production bin/rails c in app-root/repo.

Can’t run rails server

I’m working on getting my first rails application, but for whatever reason, when I run the command $rails server, my terminal throws back this error:
/Users/Toni/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.4/lib/bundler/resolver.rb:287:in `resolve': Could not find gem 'jquery-rails (= 2.0.0) ruby' in the gems available on this machine. (Bundler::GemNotFound)
from /Users/Toni/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.4/lib/bundler/resolver.rb:161:in `start'
from /Users/Toni/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.4/lib/bundler/resolver.rb:128:in `block in resolve'
from /Users/Toni/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.4/lib/bundler/resolver.rb:127:in `catch'
from /Users/Toni/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.4/lib/bundler/resolver.rb:127:in `resolve'
from /Users/Toni/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.4/lib/bundler/definition.rb:192:in `resolve'
from /Users/Toni/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.4/lib/bundler/definition.rb:127:in `specs'
from /Users/Toni/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.4/lib/bundler/environment.rb:27:in `specs'
from /Users/Toni/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/rubygems-bundler-1.0.2/lib/rubygems-bundler/noexec.rb:41:in `candidate?'
from /Users/Toni/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/rubygems-bundler-1.0.2/lib/rubygems-bundler/noexec.rb:60:in `setup'
from /Users/Toni/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/rubygems-bundler-1.0.2/lib/rubygems-bundler/noexec.rb:75:in `<top (required)>'
from /Users/Toni/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /Users/Toni/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /Users/Toni/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /Users/Toni/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/bin/ruby_noexec_wrapper:9:in `<main>'
I can’t find anything here on Stack Overflow. Any ideas?
You need to install the required gems that are used by Rails when started. Before you run rails s be sure to run bundle install or bundle update.
Make sure your Gemfile has a line that looks like: gem 'jquery-rails'
Then from your project's directory: bundle install
Because on Rubygems server, that version shows:
2.0.0 December 20, 2011 yanked

Problem with rails when trying to do rails-v

My friend just shared me this new application and I pulled it from heroku
I was just trying to do rails -v and I got
denniss$ rails -v
/Users/denniss/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.5/lib/bundler/resolver.rb:132:in `block in resolve': Could not find gem 'selenium-webdriver', required by 'capybara', in any of the sources (Bundler::VersionConflict)
from /Users/denniss/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.5/lib/bundler/resolver.rb:130:in `catch'
from /Users/denniss/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.5/lib/bundler/resolver.rb:130:in `resolve'
from /Users/denniss/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.5/lib/bundler/definition.rb:153:in `resolve'
from /Users/denniss/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.5/lib/bundler/definition.rb:93:in `specs'
from /Users/denniss/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.5/lib/bundler/definition.rb:137:in `specs_for'
from /Users/denniss/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.5/lib/bundler/definition.rb:126:in `requested_specs'
from /Users/denniss/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.5/lib/bundler/environment.rb:23:in `requested_specs'
from /Users/denniss/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb:11:in `setup'
from /Users/denniss/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.5/lib/bundler.rb:95:in `setup'
from /Users/denniss/Sites/mogo-production/config/boot.rb:5:in `<top (required)>'
from script/rails:8:in `require'
from script/rails:8:in `<main>'
Edit:
I did "bundle check" and I got this
/Library/Ruby/Site/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem bundler (>= 0) (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems.rb:214:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:1082:in `gem'
from /usr/bin/bundle:18
Edit2:
Okay, the most up to date error that I gate after successfully installing rmagick is this. I was able to do rake db:create and migrate. I tried to do rails server (using rails3) and I get this error
/Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing': uninitialized constant ActiveSupport::CoreExtensions (NameError)
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/facebooker-1.0.74/lib/facebooker/adapters/adapter_base.rb:6
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/facebooker-1.0.74/lib/facebooker.rb:259
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb:64:in `require'
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb:64:in `require'
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb:62:in `each'
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb:62:in `require'
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb:51:in `each'
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb:51:in `require'
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.0.rc.5/lib/bundler.rb:107:in `require'
from /Users/denniss/Sites/mogo-production/config/application.rb:5
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.0.rc/lib/rails/commands.rb:28:in `require'
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.0.rc/lib/rails/commands.rb:28
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.0.rc/lib/rails/commands.rb:27:in `tap'
from /Users/denniss/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.0.rc/lib/rails/commands.rb:27
from script/rails:9:in `require'
from script/rails:9
The application requires a gem that isn't installed, in this case "selenium-webdriver." Try bundle check to see if there are additional errors, then proceed to install the gems you're missing.
Edit from comments:
In your first code block you're using MRI 1.9, then you moved on to MRI 1.8 and now you're suddenly using REE. That tells me that you've got (at least) three different Ruby interpreters on your computer, which isn't making your life easier. In all likelyhood, you've got gems all over the place as well. Do you have previous experience with RVM? If not, my suggestion would be to remove RVM, stick with one Rails interpreter (system default, MRI 1.8) and go from there.
Installing rmagick is nearly a rite of passage for Rails developers. It's horrifying at first, but ultimately not that complicated. What the gem really wants to see during native compilation is an install of ImageMagick.
On Linux, I've usually had good luck with whatever package manager is in use. sudo apt-get install imagemagick for example.
If you are on OS X, then it's a bit more work. I've used port several times, and most recently brew to install ImageMagick. If you're on OS X, then head for Google and search for instructions with whatever package management system you happen to be using.

Resources