Error when trying to start server after upgrading to Rails 3 - ruby-on-rails

I've just upgraded to Rails 3, using the instructions from this railscast. When I try to start the server, this is what happens:
$ rails s
script/rails:6:in `require': no such file to load -- rails/commands (LoadError)
from script/rails:6:in `<main>'
I can't find this exact error using Google. Anyone know what is causing this? Thanks for reading
EDIT:
Here's the console output:
$ rvm 1.9.2
$ rails -v
Rails 3.0.1
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
$ rails new . -d sqlite3
(all the overwrite checking stuff happens here)
$ bundle install
...
Your bundle is complete! It was installed into /Users/ben/.rvm/gems/ruby-1.9.2-p0
$ rails s
script/rails:6:in `require': no such file to load -- rails/commands (LoadError)
from script/rails:6:in `<main>'
$ rvm list
rvm rubies
=> ruby-1.9.2-p0 [ x86_64 ]
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
$ rails -v
script/rails:6:in `require': no such file to load -- rails/commands (LoadError)
from script/rails:6:in `<main>'

Have you actually installed the rails 3.0.x gem? Maybe you missed this step :).
It looks like your script/rails script cannot find the included file from rails gem. You need to install all needed gems separately for each version of Ruby you're using (e.g. 1.8.7 and 1.9.2).

Maybe you can just reinstall your rubygem, or update it.
Rubygem versions should fit to your Ruby versions. For every Ruby version you installed separated Gems needed.
May I ask did you use any 'sudo' with RVM installations? Better to avoid, see here:
http://rvm.beginrescueend.com/rubies/rubygems/
Can you list here please your "gem list" after switched to default Ruby version you want to use? Also "rvm list" "ruby -v" "gem -v" and your OS please.
Also wise to write to forum at the section you downloaded Railscasts' video, because maybe others will have the same problem.

Related

error `require' /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot

I installed ubuntu and want to install Ruby on Rails. But tried few times and see same error after I run 'rails new app' I see error
from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler/setup (LoadError)
The server also doesn't run because of it.
You need to install Bundler first.
gem install bundler
Bundler is a Ruby gem. It's a Ruby gem used to manage other Ruby gems (often called dependencies).
can you try below command?
echo $GEM_PATH
and check the ruby version, Is that different version then ruby/2.5.0?
and if it's different then set your $GEM_PATH from below command.
SetEnv GEM_HOME /usr/lib/ruby/gems/1.8(set your path)
You need to use
gem install os

Bundler::RubyVersionMismatch: Your Ruby version is 2.3.1, but your Gemfile specified 2.1.8

Bundler::RubyVersionMismatch: Your Ruby version is 2.3.1, but your Gemfile specified 2.1.8
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/definition.rb:417:in `validate_ruby!'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:91:in `setup'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/setup.rb:19:in `<top (required)>'
/opt/chef/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/opt/chef/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
bundler: failed to load command: rake (/home/deploy/.bundler/app_name/ruby/2.1.0/bin/rake)
All the places it is showing: 2.1.8
ruby -v ==> 2.1.8
Gemfile has ==> 2.1.8
No idea about where it is taking version 2.3.1 from.
I want to remove 2.3.1 from wherever it is taking it.
Not sure, its an error related to chef setup or ruby installation on server.
Any help would be greatly appreciated.
Your bundle executable apparently is linked to the Ruby shipped with your local Chef installation (which uses Ruby 2.3.1 in this case).
This can happen when chef's executables are in your PATH and you don't have a different version of bundler installed elsewhere.
Assuming that you have a sane PATH, it might be enough to run
gem install bundler
to install the current version of bundler with your own Ruby (that is, the one install in /usr/local rather than in /opt/chef/embedded).

rails -v Get different ERRORS -

I'm really frustrated two day trying to work with rails for first time but I got many errors right now when I try to get the rails version got te next:
➜ first_app $ pwd
/Users/ChrispazDev/rails_projects/first_app/first_app
➜ first_app $ rails -v
Bundler is using a binstub that was created for a different gem.
This is deprecated, in future versions you may need to `bundle binstub rails` to work around a system/bundle conflict.
Rails 4.2.3
➜ first_app $ cd ..
➜ first_app $ rails -v
/Users/ChrispazDev/.rvm/gems/ruby-2.2.1#update3tutorial/bin/rails:23:in `load': cannot load such file -- /Users/ChrispazDev/.rvm/gems/ruby-2.2.1#update3tutorial/gems/rails-4.2.3/bin/rails (LoadError)
from /Users/ChrispazDev/.rvm/gems/ruby-2.2.1#update3tutorial/bin/rails:23:in `<main>'
from /Users/ChrispazDev/.rvm/gems/ruby-2.2.1#update3tutorial/bin/ruby_executable_hooks:15:in `eval'
from /Users/ChrispazDev/.rvm/gems/ruby-2.2.1#update3tutorial/bin/ruby_executable_hooks:15:in `<main>'
➜ first_app
Sorry if it's something stupid but I'm really lost.
Mac OS 10.10.3
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
Regards.
It appears that the install of Rails is messed up. The last error message comes from when you were at the path /Users/ChrisapzDev/rails_projects/first_app compared with the original message inside a sub-directory to this path.
Additionally notice that you have RVM installed so you may need to
Test the path that is being used for the invocation of rails using explicit ./rails -v to see what happens
Clean out the RVM Gemset rvm gemset empty
Reinstall rails in the context of the gemset you have allocated via RVM.
It is because of RVM, your ruby versions are messed ( Your system ruby, and ruby you installed with rvm). There is no need to uninstall RVM as it will help you to switch between your ruby versions.
Try using below code
rvm use system // for using system ruby
rvm use x.x.x // Here x.x.x is version of ruby
as rvm use 2.2.2
May be this tutorial will help you .

Cannot Create New Rails Project: `require': cannot load such file -- /config/boot (LoadError)

I am trying to create a new Rails project,
Jakes-Air:code JakeWengroff$ rails new MyNewProject -T
but I keep getting this error:
script/rails:5:in `require': cannot load such file -- /Users/JakeWengroff/config/boot (LoadError)
from script/rails:5:in `<main>'
Checking the Ruby version, ruby -v, I get
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
When I want to check the version of Rails, rails -v, I get the same error as when I want to initiate a new Rails proejct:
script/rails:5:in `require': cannot load such file -- /Users/JakeWengroff/config/boot (LoadError)
from script/rails:5:in `<main>'
So, I reinstalled Rails, gem install rails -v 4.2.0:
Successfully installed rails-4.2.0
Parsing documentation for rails-4.2.0
Done installing documentation for rails after 1 seconds
1 gem installed
I also did bundle install and bundle check and everything was fine. But the error persisted.
After reviewing some other, similar questions here, I thought it had to do with gemsets. From the RVM website, I decided to try rvm gemset create rails420, which gave me
ruby-2.1.2 - #gemset created /Users/JakeWengroff/.rvm/gems/ruby-2.1.2#rails420
ruby-2.1.2 - #generating rails420 wrappers..............
But then trying rails -v and rails new MyNewProject -T still threw the original error.
Any help is greatly appreciated.
Thank you in advance.
I had a similar issue, for me it turned out to be a problem with ruby. I have installed a different version of Ruby with RVM and installed the rails gem with this other version of Ruby.
rvm install 2.2.2
gem install rails
I would not recommend this solution as a sustainable one, but I couldn't solve this in a different way and at least it will get you going again.

'require': no such file to load -- rails/cli (LoadError)

when I uninstalled bundler 1.6.2 to use 1.0.0 rails crashed. I tried this command:
gem uninstall -i /home/mayukh/.rvm/gems/ruby-1.9.2-p320#global bundler -v=1.6.2
Please note, I have uninstalled this globally
Now, when I run rails -v or rails s it shows error like this:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- rails/cli (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/bin/rails:7:in `<main>'
My ruby version is ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux]
Is it the right way to use/uninstall bundler? or is there any way to switch between bundlers?
How to fix this issue and run rails again?
Uninstall bundle might not be the better solution. If you want to force the bundle version to install something try this (as said in this post) :
bundle _1.0.0_ install
But for you current problem, you should do what tadman said. Uninstall all bundle instances and get the lastest one to force the version after.
Hope this help !

Resources