➜ ~ rvm -v
rvm 1.10.2 by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.beginrescueend.com/]
➜ ~ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
➜ ~ rails -v
/Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
from /Users/hb/.rvm/gems/ruby-1.9.3-p0/bin/rails:18:in `<main>'
➜ ~
I installed a clean installation of ruby just now, and rails, I removed all my previous gems, and I still keep getting this error. Any ideas ? And yes, I had this error before, and this is what I did
A little more info:
➜ ~ gem list
*** LOCAL GEMS ***
actionmailer (3.2.1)
actionpack (3.2.1)
activemodel (3.2.1)
activerecord (3.2.1)
activeresource (3.2.1)
activesupport (3.2.1)
arel (3.0.0)
builder (3.0.0)
bundler (1.0.22 ruby)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.1)
json (1.6.5)
mail (2.4.1)
mime-types (1.17.2)
multi_json (1.0.4)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.1)
railties (3.2.1)
rake (0.9.2.2, 0.9.2)
rdoc (3.12)
sprockets (2.3.0, 2.1.2)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
➜ ~ gem install rails
Successfully installed rails-3.2.1
1 gem installed
Installing ri documentation for rails-3.2.1...
Installing RDoc documentation for rails-3.2.1...
➜ ~ rails -v
/Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
from /Users/hb/.rvm/gems/ruby-1.9.3-p0/bin/rails:18:in `<main>'
➜ ~
It means your Rails installation is corrupted or incomplete. If you list your gems, chances are you won't find railties
$ gem list
Run the command
$ gem install rails
again. It will download and install missing dependencies, including railties.
I ran into the same problem and, in my case, it turned out to be because I had installed using sudo - it does not necessarily make rails available to ordinary users. Try running just gem install rails if you previously ran sudo gem install rails.
Worked for me
rvm reinstall 1.9.3
then
gem install rails
I ran into this same issue. If you're using RVM it's possible you switched to the wrong Ruby version which causes a gem load error if the directory uses a different version than the one you are currently set to use.
To fix, type rvm use -yourrubyversion in the app's directory in terminal. For example, if your app is set up to use ruby 1.9.3 type rvm use -1.9.3.
RVM works by separating your gems by ruby version by app, so if you switch to a different ruby version RVM will separate previously used and installed gems from the different ruby version, which is why you may be seeing tho issue.
rvm implode was the answer. Something probably went wrong before, now everything works after a rvm reinstall.
Maybe you installed two or more version of rails and railties.
gem uninstall railties
gem uninstall rails
then reinstall.
I got the same error when I installed ruby 1.9.3p194
and then I reinstalled ruby and rails
Simone's answer is great. However, if you already have your Rails gem in your Gemfile, just try to use bundle exec instead:
bundle exec rails c
And that should suffice. If not, then add
bundle install
before the mentioned command.
I also had this issue after I installed ZSH (Wanted to mess with it's templates.)
Ran
brew update
which did find some updates I wasn't missing before, but in the end
gem install rails
suddenly completely re-installing the rail/ties system. Unsure why ZSH removed it.
Uninstalling ruby, and railsinstaller and then installing railsinstaller again worked great for me!
I did 'gem install rails' on my system (ubuntu) and it installed the missing gems approx 28 of them then i did 'gem list' to check and it was all there.
Related
I have different gemsets
> rvm gemset list
gemsets for ruby-2.0.0-p247 (found in /Users/kai/.rvm/gems/ruby-2.0.0-p247)
=> (default)
global
rails4
> rvm gemset use rails4
Using ruby-2.0.0-p247 with gemset rails4
> rails -v
/Users/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'railties' (>= 0) among 43 total gem(s) (Gem::LoadError)
from /Users/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /Users/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/rails:22:in `<main>'
from /Users/kai/.rvm/gems/ruby-2.0.0-p247#rails4/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/kai/.rvm/gems/ruby-2.0.0-p247#rails4/bin/ruby_noexec_wrapper:14:in `<main>'
and when I'm doing:
> bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.0)
Installing i18n (0.6.4)
Installing multi_json (1.7.9)
Installing activesupport (3.2.7)
Installing builder (3.0.4)
Installing activemodel (3.2.7)
Installing erubis (2.7.0)
Installing journey (1.0.4)
Installing rack (1.4.5)
Installing rack-cache (1.2)
Installing rack-test (0.6.2)
Installing hike (1.2.3)
Installing tilt (1.4.1)
Installing sprockets (2.1.3)
Installing actionpack (3.2.7)
Installing mime-types (1.23)
Installing polyglot (0.3.3)
Installing treetop (1.4.14)
Installing mail (2.4.4)
Installing actionmailer (3.2.7)
Installing arel (3.0.2)
Installing tzinfo (0.3.37)
Installing activerecord (3.2.7)
Installing activeresource (3.2.7)
Installing coffee-script-source (1.6.3)
Installing execjs (1.4.0)
Installing coffee-script (2.2.0)
Installing rack-ssl (1.3.3)
Installing json (1.8.0)
Installing rdoc (3.12.2)
Installing thor (0.18.1)
Installing railties (3.2.7)
Installing coffee-rails (3.2.2)
Installing jquery-rails (3.0.4)
Using bundler (1.3.5)
Installing rails (3.2.7)
Installing sass (3.2.10)
Installing sass-rails (3.2.6)
Installing sqlite3 (1.3.7)
Installing uglifier (2.1.2)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
But I have ruby 2.0! Why it doesn't install rails 4.0 and activesupport 4.0?
bundler installs gems basing on two files:
Gemfile.lock strict versions saved during previous installation,
Gemfile loose version declaration from user.
when you generate rails project first Gemfile is generated with something like this:
gem 'rails', '~> 3.2'
after the file is generated bundle install is ran which generates Gemfile.lock in which strict versions of gems are recorded, from now on any succeeding call to bundle install will install only the versions saved in Gemfile.lock.
To update gems to newer versions:
check Gemfile for any version restrictions - that might prevent installing the versions you would like to get
run bundle update <gem_name> to update only this single gem and what is require for it - but minimalizing scope of the changes to the smallest possible set of changes.
run bundle update to update all gems to latest versions allowed in Gemfile
bundle install or in short bundle does not install the latest gem unless you have left out the version in your Gemfile. e.g.
gem 'rails'
But usually this is not the case, we specify versions to prevent application from "crashing" when some gems are updated and we unknowingly run bundle update, or for that matter move application to say test or production servers. Usually when adding a gem to Gemfile, we do:
gem 'rails', '~> 3.2.7'
Note the leading ~> in the version number. This says: use rails gem between versions 3.2.7 and less than 3.3.0.
In order for your bundle command to grab rails 4.0, you need to change that line to read either one of the following:
gem 'rails', '>= 3.2.7'
or
gem 'rails', '4.0.0'
If you use gem 'rails', '>= 3.2.7' then your rails application will use the latest gem available in your system. Note that 3.2.7 is just an example I'm using here. If you use gem 'rails', '4.0.0' then your rails application will use rails version 4.0.0.
Please note that this change might break your existing rails 3.2 application.
I am trying to install a new rails app. I've already got several rails apps on my machine, all working fine.
$ rails new app
Could not locate Gemfile
Then I figured I'd run a trace to figure out what was going on, as you wouldn't expect to have a Gemfile at this point anyway, as typically the above command would create an entire new rails app in a directory named app with the Gemfile contained within that directory.
$ rails new app --trace
Could not locate Gemfile
So I tried to reinstall everything on my computer via this detailed guide:
http://railsapps.github.com/installing-rails.html#gems
After the first 20 or so steps, I got to this command:
$ rake -v
Could not locate Gemfile
I assume something is off on my setup somewhere, but I can't see anything off.
Here are my rvm settings:
$ rvm version
rvm 1.18.10 (latest) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
$ rvm list
rvm rubies
jruby-1.6.7 [ x86_64 ]
ruby-1.9.1-p431 [ i386 ]
ruby-1.9.3-p194 [ x86_64 ]
ruby-1.9.3-p286 [ x86_64 ]
ruby-1.9.3-p327 [ x86_64 ]
=* ruby-1.9.3-p385 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ rvm gemset list
gemsets for ruby-1.9.3-p385 (found in /Users/paul/.rvm/gems/ruby-1.9.3-p385)
(default)
global
=> rails32
Here are the gems installed on my rails32 gemset
$ gem list
*** LOCAL GEMS ***
actionmailer (3.2.12, 3.2.11)
actionpack (3.2.12, 3.2.11)
activemodel (3.2.12, 3.2.11)
activerecord (3.2.12, 3.2.11)
activeresource (3.2.12, 3.2.11)
activesupport (3.2.12, 3.2.11)
arel (3.0.2)
builder (3.0.4)
bundler (1.2.4)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
json (1.7.7)
mail (2.4.4)
mime-types (1.21)
multi_json (1.6.1)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.12, 3.2.11)
railties (3.2.12, 3.2.11)
rake (10.0.3)
rdoc (3.12.1)
rubygems-bundler (1.1.0)
rvm (1.11.3.6)
sprockets (2.2.2)
thor (0.17.0)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35)
Bundler Version
$ bundle --version
Bundler version 1.2.4
.gemrc file
$ cat ~/.gemrc
---
:backtrace: false
:benchmark: false
:bulk_threshold: 1000
:sources:
- http://rubygems.org/
- https://rubygems.org
:update_sources: true
:verbose: true
Everything seems to look fine, very frustrated, please help.
This errors happens only with commands prefixed with bundle exec or for bundle install without Gemfile in current dir.
My assumption is you might be running commands that enable bundler, check:
which rake
to find out what command is run.
bundle install
in the project directory fixed it for me.
After that, I ran into this error:
There was an error in your Gemfile, and Bundler cannot continue.
And this was fixed with:
gem update bundler
Then my re-install of Ruby and Rails finally worked. It only took about four hours to make it work :-/
I don't know what's going on with my installation of ruby / rails under OSX Mountain Lion.
I start with a black rails application, run bundle and listing the installed bundles with bundle show I get this:
[..]
* sqlite3 (1.3.7)
* thor (0.17.0)
* tilt (1.3.3)
* treetop (1.4.12)
[..]
As soon as I run rake db:migrate I get the following error:
Could not find thor-0.17.0 in any of the sources
Run `bundle install` to install missing gems.
But, as shown, thor-0.17 is installed. If I force it:
sudo gem install --version 0.17 thor
Successfully installed thor-0.17.0
1 gem installed
Installing ri documentation for thor-0.17.0...
Installing RDoc documentation for thor-0.17.0...
And run the migration again, I keep having dependency errors (in this case "Could not find formtastic-2.2.1 in any of the sources") for gems that bundle says are already installed. Any help? Thanks
EDIT
Gemfile: http://pastebin.com/WSz5dLrm
Gemfile.lock: http://pastebin.com/2kuFz1kK
So after using your Gemfile I got the following error :
Bundler could not find compatible versions for gem "railties": In
Gemfile:
rails (= 3.2.8) ruby depends on
railties (= 3.2.8) ruby
sass-rails (~> 3.2.3) ruby depends on
railties (3.2.11)
Bundler could not find compatible versions for gem "actionpack": In
snapshot (Gemfile.lock):
actionpack (3.2.11)
In Gemfile:
meta_search (>= 1.1.0.pre) ruby depends on
actionpack (~> 3.1.0.alpha) ruby
Running bundle update will rebuild your snapshot from scratch, using
only the gems in your Gemfile, which may resolve the conflict.
Using rails with the version 3.2.11 fixed the bundle.
Rails 3.2.11 fixes a huge security threat anyway, so update !
I am trying to get a basic Rails application to run on my Mac OS X 10.6.5. I created a new app called demo (rails new demo), then went into the demo directory and tried to start the app with rails server.
Here is the error message I received:
"/Users/dpetrovi/.gem/ruby/1.8/gems/sqlite3-ruby-1.3.2/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10]
Abort trap"
I checked bundle install in the demo folder:
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.6)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.13)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.7)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using sqlite3-ruby (1.3.2)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Ruby, RubyGems, and sqlite3 were installed using MacPorts. Then I used gem to try to install the sqlite3-ruby interface. (sudo gem install sqlite3-ruby). Here is where I first noticed something could be off:
Successfully installed sqlite3-ruby-1.3.2
1 gem installed
Installing ri documentation for sqlite3-ruby-1.3.2...
No definition for libversion
Enclosing class/module 'mSqlite3' for class Statement not known
Installing RDoc documentation for sqlite3-ruby-1.3.2...
No definition for libversion
Enclosing class/module 'mSqlite3' for class Statement not known
I had rails running well on my system a few months ago, so I figured maybe I had some duplicates and it was trying to use the wrong one. I ran: for cmd in ruby irb gem rake; do which $cmd; done and got:
/opt/local/bin/ruby
/opt/local/bin/irb
/opt/local/bin/gem
/opt/local/bin/rake
Checking where sqlite3 also gets me: "/opt/local/bin/sqlite3" so they all seem to be in the right place. Obviously /opt/local/bin is in my system path.
If I check gems server, it shows that I have installed sqlite3-ruby 1.3.2 gem. Not sure what the problem could be?
I am using ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10]. Macports claims this is the latest (although ive seen 1.9.1)
One more thing-- in irb, I tried to check which version of sqlite3 my sqlite3-ruby is bound to, but I can only get this far:
:irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'sqlite3'
/Users/dpetrovi/.gem/ruby/1.8/gems/sqlite3-ruby-1.3.2/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10]
Abort trap
Any suggestions? Im hoping I overlooked something obvious. Thanks
Have you upgraded to Snow Leopard recently? If so, you need to reinstall MacPorts and all the ports installed with it.
I recommend using RVM instead MacPorts installed ruby.
Definitely use RVM as mentioned above and then try this in your app's directory:
rm -rf .bundle && bundle install
i had the same problem. here is how i resolved it.
removed the gem sqlite3-ruby
did bundle install
reinstalled the gem
recreated the rails app
now webrick works fine.
I am trying to install rails on Ubuntu 10.04. So far, I've executed these commands:
apt-get install build-essential libapache2-mod-passenger apache2 rubygems ruby1.8-dev libopenssl-ruby
gem install fastthread
gem install rails
Fastthread installed easily. However, trying to install rails results in:
ERROR: Error installing rails:
bundler requires RubyGems version >= 1.3.6
So, I tried gem -v which returned 1.3.5.
How do I upgrade rubygems? apt-get won't install above 1.3.5. And gem update --system results in:
ERROR: While executing gem ... (RuntimeError)
gem update --system is disabled on Debian. RubyGems can be updated using the official Debian repositories by aptitude or apt-get.
So right now I simply can't install rails, because I need a newer version of rubygems, and ubuntu won't let me upgrade my current version of rubygems.
As a side note, i tried installed rails via apt-get install rails which seemed to work, but I don't see rails as a gem when i type gem list. What's the deal with that?
Another note: The result of gem list is:
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.1, 3.0.0)
actionpack (3.0.1, 3.0.0)
activemodel (3.0.1, 3.0.0)
activerecord (3.0.1, 3.0.0)
activeresource (3.0.1, 3.0.0)
activesupport (3.0.1, 3.0.0)
arel (2.0.1, 1.0.1)
builder (2.1.2)
erubis (2.6.6)
fastthread (1.0.7)
i18n (0.4.2)
mail (2.2.9)
mime-types (1.16)
mysql (2.8.1)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.6)
railties (3.0.1, 3.0.0)
rake (0.8.7)
rubygems-update (1.3.7)
thor (0.14.4)
treetop (1.4.8)
tzinfo (0.3.23)
I assume installing rails via apt-get installed those gems? Prior to installing rails through apt-get I only had mysql and fastthread.
There is also a gem available which handles the update
sudo gem install rubygems-update
sudo /var/lib/gems/1.8/bin/update_rubygems
You have to manually install rubygems 1.3.7 (wget from website, extract, run setup.rb).
Install rvm and take control of your ruby environment.
http://rvm.io/
This may be a newer way of doing it that wasn't available before, but I ran
sudo gem update --system
and it gave me the latest version.
For some reason, Debian/Ubuntu Ruby package doesn't include the RubyGems library. Even worst, RubyGems has been bundled into Ruby 1.9.x but if you try to install it via apt-get, the package manager will force you to install them as two separate packages.
Debian/Ubuntu RubyGems package is outdated, as you noticed, and to make things even more complicated you can't upgrade the packaged version of RubyGems just installing a new RubyGems versions on top of it because the system is patched to prevent you to complete the task, as you experienced.
My suggestion is to avoid using the Ubuntu/Debian pckaged version.
The alternatives are:
for a development system, use RVM
for a production server, install Ruby from source. If you want Ruby < 1.9 you can use Ruby Enterprise edition that is also available as Debian/Ubuntu package. If you want Ruby 1.9.x, compile it from the source.