I just installed a fresh version of Ruby 1.9.2 via RVM on Mac OSX 10.7. I've activated 1.9.2 and my system seems to recognize ruby/gem/rails:
which ruby => /Users/me/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
which gem => /Users/me/.rvm/rubies/ruby-1.9.2-p290/bin/gem
which rails => /Users/me/.rvm/gems/ruby-1.9.2-p290/bin/rails
I've bundle install'ed my existing rails app. No errors upon gem installation. Everything comes up on 'gem list'. However, when I try to bootstrap the app with 'rails server', I get the following error:
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require': no such file to load -- sass/rails/version (LoadError)
Full trace: https://gist.github.com/1215816
Again, sass and rails are installed:
gem list | grep sass => sass (3.1.7)
gem list | grep rails => rails (3.1.0)
I'm not sure what the 'version' part is about. Any ideas?
Turns out I didn't have the sass-rails gem installed. That must have been what the error was trying to communicate. Working now!
Related
Error when doing rails new blah, after a project where I put rails back to an early version
rails was working fine, I could do rails new blah
I wanted to test changing rails versions for a project. My experience up until this point has been that changing the rails version of a project won't change rails globally! So my experience has been that when CDing out of a directory and doing rails -v I'm still on 5.2.2.1
So I made a project with the aim to push back to rails 0.8.0 (just as a test!)
~/rubymac/test16$ cat Gemfile | grep "^gem 'rails'"
gem 'rails', '0.8.0'
~/rubymac/test16$
and I did bundle update rails
and no error, and I saw in Gemfile.lock that rails 0.8.0 seems to be specified there so I guess that worked that far.
Then I did cd .. and did rails -v expecting to (still) see rails 5.2.2.1 which has been my experience in the past when I put a project back to a slightly earlier version of rails. But rails -v didn't work. And rails new blah123 didn't work either.
~/rubymac$ rails -v
(in /usr/local/lib/ruby/gems/2.5.0/gems/rails-0.8.0)
rake aborted!
LoadError: cannot load such file -- rake/rdoctask
/usr/local/lib/ruby/gems/2.5.0/gems/rails-0.8.0/Rakefile:3:in `<top (required)>'
/usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
~/rubymac$
and
~/rubymac$ rails new blah2432
(in /usr/local/lib/ruby/gems/2.5.0/gems/rails-0.8.0)
rake aborted!
LoadError: cannot load such file -- rake/rdoctask
/usr/local/lib/ruby/gems/2.5.0/gems/rails-0.8.0/Rakefile:3:in `<top (required)>'
/usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
~/rubymac$
So I searched and found this question new rails project error Rails 3. which suggested gem install rails -v3.0.9
So I did gem install rails -v5.2.2.1
and it gives no error
~/rubymac$ gem install rails -v5.2.2.1
Successfully installed rails-5.2.2.1
Parsing documentation for rails-5.2.2.1
Done installing documentation for rails after 0 seconds
1 gem installed
~/rubymac$
But rails -v still doesn't work
~/rubymac$ rails -v
(in /usr/local/lib/ruby/gems/2.5.0/gems/rails-0.8.0)
rake aborted!
LoadError: cannot load such file -- rake/rdoctask
/usr/local/lib/ruby/gems/2.5.0/gems/rails-0.8.0/Rakefile:3:in `<top (required)>'
/usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
~/rubymac$
I do gem list and see what rails versions I have
~/rubymac$ gem list | grep "^rails ("
rails (5.2.2.1, 5.2.2, 5.2.1.1, 5.2.1, 5.2.0, 5.1.6, 5.1.4, 5.0.7.2, 5.0.7.1, 5.0.1, 5.0.0, 0.8.0)
~/rubymac$
I tried uninstalling rails 0.8.0. it also prompted me to remove the executable and I said yes
~/rubymac$ gem uninstall rails -v0.8.0
Remove executables:
rails
in addition to the gem? [Yn] y
Removing rails
Successfully uninstalled rails-0.8.0
~/rubymac$ gem list | grep "^rails ("
rails (5.2.2.1, 5.2.2, 5.2.1.1, 5.2.1, 5.2.0, 5.1.6, 5.1.4, 5.0.7.2, 5.0.7.1, 5.0.1, 5.0.0)
~/rubymac$ rails -v
-bash: /usr/local/bin/rails: No such file or directory
~/rubymac$ gem install rails -v5.2.2.1
Successfully installed rails-5.2.2.1
Parsing documentation for rails-5.2.2.1
Done installing documentation for rails after 0 seconds
1 gem installed
but maybe I went a step too far in saying yes to removing the executable earlier having been prompted because now I get '..rails: no such file or directory'
~/rubymac$ rails -v
-bash: /usr/local/bin/rails: No such file or directory
~/rubymac$
even after trying to install 5.2.2.1
~/rubymac$ gem install rails -v5.2.2.1
Successfully installed rails-5.2.2.1
Parsing documentation for rails-5.2.2.1
Done installing documentation for rails after 0 seconds
1 gem installed
~/rubymac$ rails -v
-bash: /usr/local/bin/rails: No such file or directory
~/rubymac$
Added
I then tried gem uninstall rails, I uninstalled all versions. I then did sudo gem install rails. I started a new terminal window. rails -v
when I do which rails it says /usr/bin/rails which is an improvement.
But when I do rails -v it says
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
~$
~$ gem list | grep rails
coffee-rails (4.2.2, 4.2.1)
jquery-rails (4.3.1, 4.1.1)
rails (5.2.2.1)
rails-controller-testing (0.1.1)
rails-dom-testing (2.0.3, 2.0.2)
rails-html-sanitizer (1.0.4, 1.0.3)
sass-rails (5.0.7, 5.0.6)
sprockets-rails (3.2.1, 3.2.0)
actually grep rail* is better 'cos includes railties as mentioned by Uninstall Rails completely
Also, I am not using any version control manager, no rvm or rbenv
First, try closing out of your terminal and restarting. Sometimes the PATH doesn't get updated with the rails executable after installation.
If that fails...
In your terminal run:
$ gem env
This should tell your where gems have been installed. Rails is, after all, just a gem. I use .rbenv as a Rails environment manager. This means my EXECUTABLE DIRECTORY is at: /Users/me/.rbenv/versions/2.5.1/bin Inside that folder I can do:
$ ls | grep rails
and I get:
drwxr-xr-x 3 me group 96 Mar 14 10:59 rails
Yay, Rails is installed and it does exist there. If you can find this, that means you have Rails installed, but your PATH cannot find it. PATH is an environment variable that usually contains a list of known directories that contain executable files. When I type rails -v, PATH gets checked. Lets make sure my PATH is working:
/Users/me/.rbenv/shims
Good. Don't worry about shims, all you need to know is that folder contains my rails executables. Yours should be the path to the EXECUTABLE DIRECTORY. Now add your executable dir to your PATH:
export PATH=PATH:/full/path/to/EXECUTABLE_DIRECTORY
That should be it. Try to run rails again. If that fails, try to manually run your rails executable. If that fails, your executable is broken or you're not looking at the right file (much more likely).
If you can't find the executable rails, then rails DNE somehow and you need to try to reinstall.
Okay, the solution was to uninstall rails completely, and then reinstall rails. But the problem I was running into was that it wasn't uninstalling rails completely.
In order to uninstall rails completely, it's mentioned here Uninstall Rails completely
You have to uninstall not just rails, but a gem called railties!
So, when you list rails gems, don't do | grep rails, do | grep rail (singular!). i.e. Do gem list | grep rail, then you get a list of rail related gems including railties.
I deleted/uninstalled all of those gems. (though possibly I only need to uninstall railties and rails).
So then I was in a position where the rails file(in osx that's /usr/bin/rails), was gone And, those gems were gone, which is fine.
(what I didn't want is either a)a position where the rails file is there and rails gives an error or b)the rails file is not there) So that was then fine in that it was uninstalled completely.
Then I did gem install rails, and it installed rails and related gems. And it was fine.
I have installed multiple version of rails on my Ubuntu machine locally using Rbenv. Rails -v command works fine when I use it from some project. It shows the version like "2.3.8". But it shows error when I use Rails command from the main directory.
Rails -v or Rails new test_app:
Blockquote
/home/rashed/.rbenv/versions/2.2.1/bin/rails:23:in `load': cannot load such file -- /home/rashed/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/rails-4.2.0/bin/rails (LoadError)
from /home/rashed/.rbenv/versions/2.2.1/bin/rails:23:in
Blockquote
.
Gem shows these installed rails versions (4.2.0, 2.3.8, 2.3.4)
I am using ruby "2.2.1p85".
I also tried re-installing rails but it doesn't worked in this case. I tried this command
$ gem install railties && rbenv rehash
and this worked for me like charm
When I upgraded my rails 3.2.13 application (on Win XP) from ruby 1.9.3 to ruby 2.0.0, it crashed due to gem RedCloth (4.2.9 x86-mingw32).
Message: couldn't load 2.0/redcloth_scan (LoadError). In other words: /lib/2.0/redcloth_scan.so does not exist in the gem.
Is there any solution to this problem?
(Unfortunately, RedCloth is the only Ruby tool that handles Textile.)
You can try:
Install RedCloth-4.2.9:
gem install RedCloth --platform==ruby -V
Create this directory:
ruby\lib\ruby\gems\2.0.0\gems\RedCloth-4.2.9\ext\2.0
Copy all files to that directory from:
ruby\lib\ruby\gems\2.0.0\gems\RedCloth-4.2.9\ext\redcloth_scan
Then you can use RedCloth in Ruby 2.0. I tried with jekyll 1.12.1, and that works.
You might want to stay with 1.9.3 for now, if you must use RedCloth.
RedCloth doesn't seem to support 2.0.0 yet.
I have standard ruby-head and Rails 3.1rc4.
I installed ruby-debug with following instructions from http://dirk.net/2010/04/17/ruby-debug-with-ruby-19x-and-rails-3-on-rvm/
But when i run rails s --debugger it will throw this strange error
/Users/schovi/.rvm/gems/ruby-head/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require': dlopen(/Users/schovi/.rvm/gems/ruby-head/gems/linecache19-0.5.12/lib/trace_nums19.bundle, 9): Symbol not found: _ruby_current_thread (LoadError)
Referenced from: /Users/schovi/.rvm/gems/ruby-head/gems/linecache19-0.5.12/lib/trace_nums19.bundle
Expected in: flat namespace
in /Users/schovi/.rvm/gems/ruby-head/gems/linecache19-0.5.12/lib/trace_nums19.bundle - /Users/schovi/.rvm/gems/ruby-head/gems/linecache19-0.5.12/lib/trace_nums19.bundle
from /Users/schovi/.rvm/gems/ruby-head/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `block in require'
from /Users/schovi/.rvm/gems/ruby-head/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `block in load_dependency'
Any idea?
Thanks, David
UPDATE:
Looks like you only need to put this in your gemfile:
gem "debugger"
and now works.
Old article follows
====================================
Jerome is correct, but lacking in the details. Here is the blow by blow, taken from this https://gist.github.com/1331533, in particular thanks to andrewroth's post. I've tested this as of the time of this post. One hopes that the changes will be deployed somewhere standard soon.
Installing ruby debugger on ruby 1.9.3-p125:
export PATCH_LEVEL=`ruby -e 'puts RUBY_PATCHLEVEL'`
export RVM_SRC=$HOME/.rvm/rubies/ruby-1.9.3-p$PATCH_LEVEL/include/ruby-1.9.1
gem install archive-tar-minitar
gem install ruby_core_source -- --with-ruby-include=/$RVM_SRC
export RVM_SRC=$HOME/.rvm/rubies/ruby-1.9.3-p$PATCH_LEVEL/include/ruby-1.9.1/ruby-1.9.3-p$PATCH_LEVEL
wget http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
wget http://rubyforge.org/frs/download.php/63094/ruby-debug19-0.11.6.gem
wget http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
gem install linecache19-0.5.13.gem -- --with-ruby-include=/$RVM_SRC
# if that step failed, and you are running OSX Lion, then following this post can help you:
# http://stackoverflow.com/questions/8032824/cant-install-ruby-under-lion-with-rvm-gcc-issues
# this happens if you recently installed xcode from the app store.
# bizarrely, for me I had to do this: ln -s /usr/bin/gcc /usr/bin/gcc-4.2
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/$RVM_SRC
Then edit Gemfile:
gem 'linecache19', '0.5.13', :path => "~/.rvm/gems/ruby-1.9.3-p#{RUBY_PATCHLEVEL}/gems/linecache19-0.5.13/"
gem 'ruby-debug-base19', '0.11.26', :path => "~/.rvm/gems/ruby-1.9.3-p#{RUBY_PATCHLEVEL}/gems/ruby-debug-base19-0.11.26/"
gem 'ruby-debug19', :require => 'ruby-debug'
Then install:
bundle install
I used the gem 'debugger' which is a fork of ruby-debug(19) that works on 1.9.2 and 1.9.3 and installs easily for rvm/rbenv rubies.
It makes the error disappear !
It looks like this is a known bug in ruby-debug-base, for the moment. I have added my comment to the issue on the bug tracker. Plase consider adding your notes as well:
http://rubyforge.org/tracker/index.php?func=detail&aid=29222&group_id=8883&atid=34290
In the meantime, ruby 1.9 has a built-in debugger; its just very slow. Manually add this require line to your code:
require 'debug'
Also, the debugger breaks on all StandardError exceptions by default, so do this when it first starts up:
catch off
If you are running Ruby 1.9.3x, to fix it go to ruby-debug on rubyforge, download and install ruby-debug-base 0.11.26 and linecache19 0.5.13. Modify your Gemfile to use these files, then run
bundle update ruby-debug-base19
Debugger should work now.
Thanks
Jerome
This was fixed upgrading to the latest gems of all debug
Using ruby 1.9.3, I was able to get this to work by adding the gem 'ruby-debug-base19x' (note the 'x' at the end of the name) in addition to 'ruby-debug19'.
My system is rvm 1.18.10 and ruby 1.9.3p392 on Mac OSX 10.8.5. I first installed gem 'ruby-debug19', but for the well-known reason, the debugger did not work.
I then ran
local$ gem install 'debugger'
as suggested by many other posts. The gem was installed successfully with the following outputs:
local$ gem install debugger
Fetching: debugger-ruby_core_source-1.2.3.gem (100%)
Fetching: debugger-linecache-1.2.0.gem (100%)
Fetching: debugger-1.6.2.gem (100%)
Building native extensions. This could take a while...
Successfully installed debugger-ruby_core_source-1.2.3
Successfully installed debugger-linecache-1.2.0
Successfully installed debugger-1.6.2
3 gems installed
Installing ri documentation for debugger-ruby_core_source-1.2.3...
Installing ri documentation for debugger-linecache-1.2.0...
Installing ri documentation for debugger-1.6.2...
Installing RDoc documentation for debugger-ruby_core_source-1.2.3...
Installing RDoc documentation for debugger-linecache-1.2.0...
Installing RDoc documentation for debugger-1.6.2...
local$ irb
1.9.3-p392 :002 > require 'debugger'
=> true
I then ran
local$ rails server --debug
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:
in`require': dlopen(/usr/local/rvm/gems/ruby-1.9.3-p392/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle,
9): Symbol not found: _ruby_current_thread (LoadError)
Referenced from: /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
Expected in: flat namespace
in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle - /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
......
I resolved this error by commenting out the line "gem 'ruby-debug19'" and adding a new line "gem 'debugger'" in the Gemfile, and then ran
local$ bundle update
After that, everything worked fine.
local$ rails server --debug
=> Booting WEBrick
=> Rails 3.2.14 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
=> Debugger enabled
[2013-10-15 12:50:21] INFO WEBrick 1.3.1
[2013-10-15 12:50:21] INFO ruby 1.9.3 (2013-02-22) [x86_64-darwin10.8.0]
[2013-10-15 12:50:21] INFO WEBrick::HTTPServer#start: pid=7206 port=3000
I just installed RoR 3 with sudo gem install rails. I tried this multiple times, but every time I run $ rails I get an error and I hate it:
imac:~ rsonic$ rails
/Users/rsonic/.gem/ruby/1.8/bin/rails:19:in `load': no such file to load -- rails (LoadError)
from /Users/rsonic/.gem/ruby/1.8/bin/rails:19
How can I fix this? I want to use Rails again!
1.Install rvm(Ruby version manager)
sudo gem install rvm
2.Go to install path of rvm and do
rvm-install
3.Check if the install was successful by running
rvm
4.Check for current version of ruby
ruby -v
5.Install ruby 1.9.2 using rvm
rvm install 1.9.2
6.User ruby 1.9.2 with the help of rvm do
rvm 1.9.2
(you can switch back to system's default ruby version by running command >rvm system)
7.Install gems using rvm do
rvm gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
This will install gems locally for ruby1.9.2 without touchin the sytem ruby
8.Install RAILS3 beta release
rvm gem install rails --pre
9.Install railties which are required for RAILS3
rvm gem install railties --pre
10.For generating a new app with RAILS3 skeleton now do
rails myapp
Note all ruby script/ commands have changed to rails *
e.g: RAILS<3
ruby script/server -p 3004
RAILS3
rails server -p 3004
Hope it helps...