Unable to start rails server in Rails 5 - ruby-on-rails

I installed Rails using RVM. Everything works fine like generating a new app with rails new app. bundle install and every other command runs fine as well.
But when I start my Rails server with rails -server I get the following error, which I'm not able to understand.
rails aborted!
NameError: undefined local variable or method `rver' for #<Rake::Application:0x00563aa7540988>
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/railties-5.0.2/lib/rails/commands/rake_proxy.rb:12:in `block in run_rake_task'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/railties-5.0.2/lib/rails/commands/rake_proxy.rb:11:in `run_rake_task'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
/home/mrrobot/rails/demo/app/bin/rails:9:in `require'
/home/mrrobot/rails/demo/app/bin/rails:9:in `<top (required)>'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `load'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `call'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/lib/spring/client/command.rb:7:in `call'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/lib/spring/client.rb:30:in `run'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/bin/spring:49:in `<top (required)>'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `load'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `<top (required)>'
/home/mrrobot/rails/demo/app/bin/spring:15:in `require'
/home/mrrobot/rails/demo/app/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
(See full trace by running task with --trace)
Ruby version: 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
Rails version: 5.0.2
RubyGems version: 2.6.11

It's rails server, without dash
or just
rails s

Related

Can't start old rails version (syntaxError)

I just imported a 5 years old rails project on my ubuntu 18.04 server. I downloaded all the requirements such as ruby 2.0.0 or rails 3.2.22 and all the gems.
At the moment I'm trying to run: rails app:update which gives me the following error (the same when I run rail s) :
/usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler/runtime.rb:81:in `require': /usr/local/rvm/gems/ruby-2.0.0-p648/gems/coverband-5.1.0/lib/coverband.rb:83: syntax error, unexpected '.' (SyntaxError)
(Rake&.application&.top_level_tasks ...
^
from /usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler/runtime.rb:81:in `block (2 levels) in require'
from /usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler/runtime.rb:76:in `each'
from /usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler/runtime.rb:76:in `block in require'
from /usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler/runtime.rb:65:in `each'
from /usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler/runtime.rb:65:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler.rb:114:in `require'
from /home/ project/apps/current/config/application.rb:9:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.22.5/lib/rails/commands.rb:53:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.22.5/lib/rails/commands.rb:53:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.22.5/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.22.5/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I also get an error when I try to run: rake migrate
rake aborted!
SyntaxError: /usr/local/rvm/gems/ruby-2.0.0-p648/gems/coverband-5.1.0/lib/coverb and.rb:83: syntax error, unexpected '.'
(Rake&.application&.top_level_tasks ...
^
/home/ project/apps/current/config/application.rb:9:in `<top (required)>'
/home/ project/apps/current/Rakefile:5:in `require'
/home/ project/apps/current/Rakefile:5:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p648/bin/ruby_executable_hooks:22:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p648/bin/ruby_executable_hooks:22:in `<main>'
Thanks for your help!
The safe navigation operator (&.) was added in Ruby 2.3.0.
Some of the code that changed by running rails app:update uses it.
Hence you first need to upgrade your Ruby version to 2.3.0+.
Rails upgrades and Ruby version requirements

rails server bin/rails:6: warning: already initialized constant APP_PATH error

I'm using Ubuntu 14.04 and I'm a beginner using Ruby on Rails
I recently installed rbenv, ruby 2.3.0 and rails 4.2.4 following the tutorial: https://gorails.com/setup/ubuntu/14.04
After installation, I ran ruby -v and rails -v and got the expected versions. So far so good. Then I ran rails s and I got:
rails server bin/rails:6: warning: already initialized constant APP_PATH error
To fix it I ran:
rake rails:update:bin following this StackOverflow question: rails server bin/rails:6: warning: already initialized constant APP_PATH error which resulted to a new error (I also removed Spring gem):
Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 10.5.0. Prepending `bundle exec` to your command may solve this.
/my-home-directory/my-ruby-on-rails-project/config/boot.rb:3:in `<top (required)>'
/my-home-directory/my-ruby-on-rails-project/config/application.rb:1:in `<top (required)>'
/my-home-directory/my-ruby-on-rails-project/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/my-home-directory/my-ruby-on-rails-project/config/boot.rb:3:in `<top (required)>'
/my-home-directory/my-ruby-on-rails-project/config/application.rb:1:in `<top (required)>'
/my-home-directory/my-ruby-on-rails-project/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
I prepend 'bundle exec' and got the following error:
/my-home-directory/my-ruby-on-rails-project/.bundle/gems/nokogiri-1.6.7.2/lib/nokogiri.rb:29:in `require': libruby.so.2.2: cannot open shared object file: No such file or directory - /my-home-directory/my-ruby-on-rails-project/.bundle/gems/nokogiri-1.6.7.2/lib/nokogiri/nokogiri.so (LoadError)
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/nokogiri-1.6.7.2/lib/nokogiri.rb:29:in `rescue in <top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/nokogiri-1.6.7.2/lib/nokogiri.rb:25:in `<top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/fog-1.23.0/lib/fog/xml.rb:1:in `require'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/fog-1.23.0/lib/fog/xml.rb:1:in `<top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/fog-1.23.0/lib/fog.rb:11:in `require'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/fog-1.23.0/lib/fog.rb:11:in `<top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave/storage/fog.rb:3:in `require'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave/storage/fog.rb:3:in `<top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave/storage.rb:9:in `require'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave/storage.rb:9:in `<top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave.rb:78:in `require'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave.rb:78:in `<top (required)>'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `block (2 levels) in require'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from /my-home-directory/my-ruby-on-rails-project/config/application.rb:7:in `<top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `require'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:8:in `require'
from bin/rails:8:in `<main>'
Before installing rbenv, I was using RVM and I had the same errors popping around. I can't figure out what changes I've done when I started having these issues.
For the sake of my sanity, any help is very appreciated!
Thank you all!
A friend of mine just helped me and fixed this.
What he suggested:
Create a file .ruby-version in my project directory with one line: ruby-2.3.0 - This will make sure that we're not loading another nokogiri version
Remove the bundler by running: rm -rfv .bundle
Then run: bundle
Run: bundle exec rails s
Works like a charm.
I asked him why he thinks I had these issues and said: Hard to say, a messed up .bundle directory can do a lot of funky stuff.

Rails development environment after new distro is installed in /root and /home kept same

I changed my distro from Ubuntu to Elementary OS. I kept my /home directory, so that I don't have to install anything.
I followed GoRail's guide to install Rails.
Now when I try to re-install everything from the same guide, it turns out that RVM, Ruby and Rails are already there.
➜ sample_app git:(master) ✗ rails -v
Rails 4.2.2
However, when I go to my old projects and try to start a server it throws the following error:
➜ sample_app git:(master) ✗ rails s
/home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from /home/abhimanyuaryan/Public/RoR/sample_app/config/application.rb:7:in `<top (required)>'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `require'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/railties-4.2.2/lib/rails/commands.rb:17:in `<top (required)>'
from /home/abhimanyuaryan/Public/RoR/sample_app/bin/rails:9:in `require'
from /home/abhimanyuaryan/Public/RoR/sample_app/bin/rails:9:in `<top (required)>'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
from /home/abhimanyuaryan/.rvm/gems/ruby-2.2.3/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/abhimanyuaryan/Public/RoR/sample_app/bin/spring:13:in `require'
from /home/abhimanyuaryan/Public/RoR/sample_app/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
➜ sample_app git:(master) ✗
As per your error message
There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
It seems you don't have NodeJS installed. Run
sudo apt-get install nodejs
bundle install
See "There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)".

Repairing Rails and Server and on Nitrous.io

I was doing One Month Rails's tutorial on Nitrous.io. At one point, some weird files appeared on my tree, and I deleted them. Everything stopped working.
I ran:
$ git add .
$ git checkout -f
and restored the tree.
BUT, when I ran:
$ rails server
I get:
action#first-project-48185:~/pinteresting$ rails server
-bash: rails: command not found
I also tried:
$ ruby -v #and got an older version, so I reinstalled it
$ rails -v
action#first-project-48185:~/pinteresting$ rails -v
-bash: rails: command not found
When I run:
$ ruby -v #on MAC terminal, I get the correct version
$ rails -v #on MAC terminal, I get the correct version
Interestingly, when I run:
$ rails server or $ rails server -p 4000
I get:
Franciscos-MacBook-Pro:pinteresting franciscomello$ rails server
/Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
and a bunch of other text below:
from /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3.rb:2:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /Users/franciscomello/Desktop/pinteresting/config/application.rb:7:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Franciscos-MacBook-Pro:pinteresting franciscomello$ rails server -p 4000
/Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3.rb:2:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /Users/franciscomello/Desktop/pinteresting/config/application.rb:7:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
What's frustrating is I was on my largest streak without any errors or bugs :(
Any ideas?
I can't tell why Rails is no longer working from those errors, but I would recommend reinstalling rails. Run the following command to reinstall Rails:
gem install rails
From here you should be able to run rails server.
You could also run bundle install within the project directory if your Gemfile includes other gems which need to be installed.

Why won't Rails' console start or make new apps?

A few days ago I updated my gems because things weren't running so fine, so I went back to 1.4.2. Since then I'm getting all kind of weird errors.
I'm using Ruby 2.0.0p247, Rails 4.0 and Ubuntu.
If I try to start a new app using rails new eraseme, everything goes fine until it's time to do bundle install. The output is:
run bundle install
/usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/generators/app_base.rb:270:in `require': cannot load such file -- bundler (LoadError)
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/generators/app_base.rb:270:in `bundle_command'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/generators/app_base.rb:277:in `run_bundle'
from (eval):1:in `run_bundle'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `block in invoke_all'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `map'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `invoke_all'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/group.rb:233:in `dispatch'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/application.rb:43:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/cli.rb:15:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/cli.rb:15:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/bin/rails:9:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/bin/rails:9:in `<top (required)>'
from /usr/local/bin/rails:23:in `load'
from /usr/local/bin/rails:23:in `<main>'
If I try to open the console, I get:
>> bundle exec rails console
Loading development environment (Rails 4.0.0)
/usr/local/lib/ruby/2.0.0/irb/locale.rb:150:in `block in search_file': undefined method `try_activate' for Gem:Module (NoMethodError)
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:158:in `block in each_localized_path'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:167:in `each_sublocale'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:157:in `each_localized_path'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:145:in `search_file'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:124:in `find'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:108:in `load'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:32:in `initialize'
from /usr/local/lib/ruby/2.0.0/irb/init.rb:114:in `new'
from /usr/local/lib/ruby/2.0.0/irb/init.rb:114:in `init_config'
from /usr/local/lib/ruby/2.0.0/irb/init.rb:16:in `setup'
from /usr/local/lib/ruby/2.0.0/irb.rb:380:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Have you already installed bundler? If not, try:
gem install bundler
If so, try:
gem install bundler --pre
If you running Ruby version manager, what version are you running? You might be set to the wrong version of Ruby.
I think it would be easier for you if you used RVM or some other version manager.
if you have multiple versions of rubygems installed, uninstall all but the one you want to use.
I think rails 4 requires rubygems 2.x.
Also check the bundler version.

Resources