RedCloth loaderror on ruby 2.0.0 [i386-mingw32] - ruby-on-rails

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.

Related

Mismatched ruby version after downgrade from 2.4.1 to 2.3.3 while running bundle install

While attempting to solve another issue identified in this thread:
Error while trying to load the gem 'devise. ActiveSupport: Duration can't be coerced into Integer, I followed the suggested solution and changed my ruby version from 2.4.1 to 2.3.3 using rbenv. I also made similar changes in my Gemfile to reflect the new ruby version. However, when I tried to bundle install again, it throws an error saying that my ruby version is 2.4.1, when my Gem specified 2.3.3. However, running ruby -v shows my ruby version is on 2.3.3.
$ bundle install
Your Ruby version is 2.4.1, but your Gemfile specified 2.3.3
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
Any help here would be appreciated. Thank you!
Gem installation is specific to ruby version, so the bundler you're using is likely installed to your old ruby. Try installing bundler again:
gem install bundler
That should fix your problem.

Rails Seeing Incorrect Ruby Version

I've built a Rails 5 app and it's working great but I'd like to change the Ruby version I'm running it on. I'm using RVM 1.27.0 on Ubuntu 16.04. I copied the app folder to a different path and changed the versions on .ruby_version and my Gemfile:
Gemfile:
source 'https://rubygems.org'
ruby "2.2.2"
.ruby_version:
ruby-2.2.2
Once I updated these I moved out and back into the folder and ran a ruby -v:
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
I then ran a bundle install and everything installed without error.
However, when I ran rake -T I get this:
Your Ruby version is 2.3.1, but your Gemfile specified 2.2.2.
My $PATH looks good:
/home/ken/.rvm/gems/ruby-2.2.2/bin:/home/ken/.rvm/gems/ruby-2.2.2#global/bin:/home/ken/.rvm/rubies/ruby-2.2.2/bin:/home/ken/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
What am I missing? Where is Rails pulling the Ruby version from? How can I fix this?
You're using a system bundler which is why you're seeing a different version of ruby. All you need to do is install bundler under your current ruby version:
gem install bundler
bundle install
Once you do a bundle install you'll get the gem's built for the correct ruby version.
The file name should be .ruby-version, not .ruby_version.
And you also should have file .ruby-gemset with content
gemset
check this link, Create .ruby-version and .ruby-gemset with rvm
You can also try spring stop and gem install bundler

How to switch rails 4 to rails 3?

This is what I have done:
gem uninstall rails
gem uninstall railties
gem install rails 3.2
And terminal shows this code:
Done installing documentation for rails, railties after 1189 seconds
ERROR: Could not find a valid gem '3.2' (>= 0) in any repository
2 gems installed
weare138#mycomp:~$ rails -v
Rails 4.1.5
How to fix it?
You are missing the -v flag so rubygems is thinking that 3.2 is the name of a different gem and you are installing the current version (4.1.5). Instead try:
gem install rails -v 3.2.19
You should not need to remove up-to-date versions as you can specify the older rails version when starting a project with:
rails _3.2.19_ new myapp
If you are using RVM, create a new gemset
rvm gemset create <name>
Then you can switch to that gemset using
rvm use 1.9.3#<name> #assuming your ruby version is 1.9.3
That gives a clean gemset you can install Rails 3.2 to. Maintain multiple gemsets and switch between them

Unable to activate rails 3.0.1 because of bundler version conflict

so I run:
$ gem install rails --version 3.0.1
Successfully installed rails-3.0.1
1 gem installed
Installing ri documentation for rails-3.0.1...
Installing RDoc documentation for rails-3.0.1...
then I get the error:
$ rails -v
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts': Unable to activate rails-3.0.1, because bundler-1.1.4 conflicts with bundler (~> 1.0.0) (Gem::LoadError)
from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:in `activate'
from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1232:in `gem'
from /usr/local/rvm/gems/ruby-1.9.3-p125#rails3tutorial/bin/rails:18:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p125#rails3tutorial/bin/ruby_noexec_wrapper:14:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p125#rails3tutorial/bin/ruby_noexec_wrapper:14:in `<main>'
So Rails 3.0.1 requires Bundler v1.0.0 - v1.0.22 (actually any 1.0.x version up to, but not including, 1.1.0), but you have a newer version of Bundler that's being loaded when Rails is started. You could uninstall the newer version(s) of Bundler (though this is a crappy way to deal with the issue) or since you're using RVM, just create a gemset for Rails 3.0.1.
$ rvm gemset create rails_3.0.1
$ rvm gemset use rails_3.0.1
$ gem install rails -v 3.0.1
$ rails -v
3.0.1
Note: this requires that Bundler not be in your global gemset for the Ruby version you're trying to use. If the global gemset contains a Bundler version equal to or higher than 1.1.0 then you'll get the same error as before.
Update: A little explanation about ~> and RubyGems versioning might be handy. The section on pessimistic version constraint in the RubyGems docs does a fantastic job of covering everything.
You may need to update to bundler 1.1.4.
gem update bundler
should do the trick.
This is possibly due to Ruby v1.9.2/3 uses bundler v1.1.4 while Rails v3.0.1 requires bundler v~1.0.0. Hence, by simply updating the Rails version to v3.2.6, the conflict is solved. This conflict can be easily solved by matching the Ruby and Rails version.
I had same problem with mysql. I uninstalled mysql gem and I installed the newest version of mysql gem. Is RVM ok?

Getting Ruby on Rails 3 to work

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...

Resources