I installed jRuby using rvm. It's version is jruby-1.6.7.2 [ i386 ].
Now I am trying to install rails on top of it.
But I am getting following error
ERROR: Error installing rails: activesupport requires Ruby version >= 1.9.3.
I am using following command to install rails which I found in many answers on so itself.
jruby -S gem install rails --pre --no-rdoc --no-ri
I also tried passing --1.9 option to jruby so that it can use ruby 1.9 interpreter. But that also not working.
jruby --1.9.3 -S gem install rails
My RVM list is as follows :
rvm rubies
=> jruby-1.6.7.2 [ i386 ]
ruby-1.8.7-p358 [ i686 ]
* ruby-1.9.3-p194 [ i686 ]
ruby-1.9.3-p286 [ i686 ]
Please guide me whats going wrong?
Are you able to update your JRuby version?
Alternatively, try set this shell variable:
export JRUBY_OPTS=--1.9
...then re-execute your gem install rails command.
Related
How do I uninstall the old ruby versions and how do can I update to GemFile to 2.4.2?
Sandys-MacBook-Pro:roughhouse-web sandychow$ bundle install
Your Ruby version is 2.4.2, but your Gemfile specified 2.2.5
Sandys-MacBook-Pro:roughhouse-web sandychow$ rvm list
rvm rubies
ruby-2.1.5 [ missing bin/ruby ]
ruby-2.2.5 [ missing bin/ruby ]
* ruby-2.4.1 [ x86_64 ]
=> ruby-2.4.2 [ x86_64 ]
To specify a Ruby version in your Gemfile, simply include the version towards the top:
For Ruby 2.4.2, you can do this:
# Gemfile
source "https://rubygems.org"
ruby "2.4.2"
# ... your gems on the following lines ...
If you want to uninstall a Ruby version, execute:
$ rvm uninstall <version_number>
So to uninstall version 2.2.5, execute:
$ rvm uninstall 2.2.5
Note: don't include the $ sign. That's just there to represent your terminal window.
More information on specifying Ruby versions in your Gemfile can be found at these links:
Heroku - Ruby versions
Coderwall
If you still experience issues, you may need to install or update bundler:
$ gem install bundler
or
$ gem update bundler
As your Gemfile specified ruby 2.2.5 and your rvm ruby version is 2.4.2, you can simply update the project gems bundle to fix the issue by doing
bundle update
This will update all the gems in your Gemfile file to get compatible with your current ruby version.
I'm having trouble understanding where this Gemfile referred to by the bundle install output is. My general project directory is /code and there is no Gemfile here, hidden or visible. I tried rvm implode to clear things out but the issue remains.
$ gem install rails
Successfully installed rails-4.2.5
Parsing documentation for rails-4.2.5
Done installing documentation for rails after 0 seconds
1 gem installed
$ rails new myapp --database=postgresql
Could not find proper version of railties (4.0.2) in any of the sources
Run `bundle install` to install missing gems.
$ rails -v
Could not find proper version of railties (4.0.2) in any of the sources
Run `bundle install` to install missing gems.
$ bundle install
Your Ruby version is 2.2.0, but your Gemfile specified 2.0.0
$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
ruby-2.2.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
It looks like you may have an issue with your global gemset. Try creating a new gemset for the app using rvm:
rvm use 2.2-head#myapp --create
From there install rails and see if all goes well.
All of the sudden, Rails' console stopped working on one of my projects. I keep getting the following error:
rails c
Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
Could not find activesupport-4.1.4 in any of the sources
Run `bundle install` to install missing gems.
So I updated Rubygems, with the following two lines (from rubygems.com)
$ gem install rubygems-update # again, might need to be admin/root
$ update_rubygems
and get the following output:
Successfully installed rubygems-update-2.4.4
Parsing documentation for rubygems-update-2.4.4
Done installing documentation for rubygems-update after 0 seconds
1 gem installed
...
RubyGems 2.4.4 installed
Parsing documentation for rubygems-2.4.4
Installing ri documentation for rubygems-2.4.4
=== 2.4.4 / 2014-11-12
Aaaaaand, then I run rails console again, and just get the same error message again.
Thoughts?
This might be the problem only if you use rvm else just ignore it.
Navigate to the root path (where your rails app is located).
type in your command line;
rvm list
You will get something like:
rvm rubies
jruby-1.7.11 [ x86_64 ]
ruby-2.0.0-p247 [ x86_64 ]
=* ruby-2.0.0-p451 [ x86_64 ]
ruby-2.1.0 [ x86_64 ]
ruby-2.1.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
If your default is not the current you have most likely changed it.
Try to change it back and run:
You can change it like so:
rvm use ruby-2.0.0-p451
When you get the right version you can make it permanent.
like so:
rvm --default use ruby-2.0.0-p451
bundle install
again.
Just a shot in the dark, but maybe try:
gem install activesupport -v 4.1.4
Then try and run rails c again.
The message also says to run gem pristine --all which will reinstall all the gems from the cache and recompile all native drivers in the gems.
Updating the Rubygems code doesn't do this so you have to explicitly run the command.
I have latest RVM installed in OX 10.9.
$ rvm rubies
* ruby-1.9.3-p545 [ x86_64 ]
=> ruby-2.1.1 [ x86_64 ]
$ rvm gemset list
gemsets for ruby-2.1.1 (found in /Users/rajveershekhawat/.rvm/gems/ruby-2.1.1)
(default)
global
rails403
rails404
=> rails410
After this i installed rails.
$ gem install rails -v 4.1.0
It got installed. It is also there in correct location within .rvm folder. But when I try using it, system says rails is not installed.
$ rails -v
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.
I have tried it twice and still unable to figure out what am I am missing. Please help.
Thanks.
This question is similar but is not helping.
Edits:
$ gem list | grep rails
rails (4.1.0)
sprockets-rails (2.1.3)
$ echo $PATH
/Users/rajveershekhawat/.rvm/gems/ruby-2.1.1#rails410/bin:/Users/rajveershekhawat/.rvm/gems/ruby-2.1.1#global/bin:/Users/rajveershekhawat/.rvm/rubies/ruby-2.1.1/bin:/Users/rajveershekhawat/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Update:
Seems like the rails was not properly installed before. I recreated the gemset and tried to intall rails again but got some error. Then I again emptied the gemset and reinstalled rails with sudo. This resolved the issue.
Try to run:
rvm use ruby-2.1.1#rails410
gem list
Can you find Rails here?
Why did you call sudo gem install rails, cant be this the problem, you do not need to use sudo.
After installing RVM, I have installed Ruby 1.8.7 then Rails 3.
When I do which rails I get /Users/davidbenhamou/.rvm/gems/ruby-1.8.7-p302/bin/rails.
But when I do rails -v I get -bash: /usr/bin/rails: No such file or directory
Why is Rails not working?
Note: I have followed all steps from RVM website and Ruby command line work fine (ruby -v).
To see the rubies you have installed:
rvm list rubies
And you'll see something like this:
ree-1.8.7-2011.03 [ i686 ]
* ruby-1.9.2-p290 [ x86_64 ]
ruby-1.9.3-p0 [ x86_64 ]
=> ruby-1.9.3-p125 [ x86_64 ]
ruby-1.9.3-p125-perf [ x86_64 ]
To use a specific one:
rvm use ruby-1.9.3-p125
then if you do ruby --version, you'll see:
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin10.7.0]
In each of these rubies you need to install all the gems you want to use. The way I do it is actually by using Bundler to install all the gems for a project. But for the simple case here, just do:
rvm all do gem install rails
This will install the rails gem in all your ruby versions. To install to a particular one, use:
rvm ruby-1.9.3-p125 do gem install rails
after you installed RVM and after you set the default Ruby version in RVM, you need to re-install all ruby gems, e.g.
gem install rails
you need to install those gems as the user, not as root.
Because from now on RVM will keep track of all installed gems by the ruby version which was used to install them!