When I type
rails _4.2.0.rc2_ new hello_app
I get this error
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'railties' (= 4.2.0.rc2) - did find: [railties-4.1.8] (Gem::LoadError)
Checked in 'GEM_PATH=/Users/a11/.gem/ruby/2.0.0:/Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0', execute `gem env` for more information
from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:324:in `to_spec'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /usr/bin/rails:22:in `<main>'
I tried installing railsties 4.2.0.rc2 using
gem install railties --pre
If you want try to use new rails version, you need execute
gem install rails --pre
instead of
gem install railties --pre
Railties its core of Rails framework but not in all. See official documentation for more information.
I re-installed rails completely
gem uninstall railties -v 4.2.0.rc2
sudo gem install rails -v 4.2.0.rc2
and that solved it.
Related
I have been fighting this thing for days. I'm on rbenv and I have multiple rubies installed trying to get one stupid decade old app running. When I do "bundle install" I get an error that looks like it's trying to install the current version of rake. Instead of using the version installed with Rails 3....see below
fonso#mybox:~/my-dev$ rails -v
Rails 3.0.0
fonso#mybox:~/my-dev$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
fonso#mybox:~/my-dev$ gem list
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.0)
actionpack (3.0.0)
activemodel (3.0.0)
activerecord (3.0.0)
activeresource (3.0.0)
activesupport (3.0.0)
arel (1.0.1)
bigdecimal (1.1.0)
builder (2.1.2)
bundler (1.0.22) <-----------Note bundler is installed
erubis (2.6.6)
i18n (0.4.2)
io-console (0.3)
json (1.5.5)
mail (2.2.20)
mime-types (1.25.1)
minitest (2.5.1)
polyglot (0.3.5)
rack (1.2.8)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.0)
railties (3.0.0)
rake (0.9.2.2) <--------Note rake is installed
rdoc (3.9.5)
thor (0.14.6)
treetop (1.4.15)
tzinfo (0.3.60)
Here is my Gemfile...
source 'http://rubygems.org'
gem 'rails', '3.0.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'will_paginate', '~> 2.3.17'
gem 'soap4r-middleware', '~> 0.8.6'
gem 'soap4r', '~> 1.5.6'
gem 'prawn-labels', '~> 0.11.3.0'
gem 'nokogiri-plist', '~> 0.3.0'
gem 'rails_sql_views', '~> 0.8.0'
# gem 'prototype_legacy_helper', '0.0.0', :git => 'https://github.com/rails/prototype_legacy_helper.git'
so Ruby and rails are installed...BUT when I do "bundle install" on my Rails 3 app I get...
fonso#mybox:~/my-dev$ bundle install
Fetching source index for http://rubygems.org/
Installing rake (13.0.3)
Gem::InstallError: rake requires Ruby version >= 2.2.
An error occured while installing rake (13.0.3), and Bundler cannot continue.
Make sure that `gem install rake -v '13.0.3'` succeeds before bundling.
fonso#mybox:~/my-dev$ bundler --version
rbenv: bundler: command not found
Why does it say bundler not found yet I can run Bundle install?
Why can I not get this rails 3 app working?
Any info will help my sanity. Thank you.
UPDATE:
After following Paul D solution I ran bundle install again...but got this error...
fonso#mybox:~/my-dev$ bundle install
Fetching gem metadata from http://rubygems.org/.............
Fetching gem metadata from http://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) was resolved to 3.0.0, which depends on
bundler (~> 1.0.0)
Current Bundler version:
bundler (1.17.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
Could not find gem 'bundler (~> 1.0.0)', which is required by gem 'rails (= 3.0.0)', in any of the sources.
#thefonso, I manage multiple decade old apps running stable on Ruby 1.9.3-p551 daily. Here are a few things to ensure:
Make sure you're running latest release of Ruby 1.9 which is 1.9.3-p551. It needs to be installed with SSL/TLS patches as per below:
# Make sure you have latest OpenSSL
sudo apt-get purge -y libssl-dev
sudo apt-get install -y libssl1.0-dev
# Now install Ruby 1.9.3-p551
rbenv install --force --patch 1.9.3-p551 < <(curl -sSL https://git.io/JOtSv)
rbenv global 1.9.3-p551 # (optional)
rbenv rehash
# Now install Bundler 1.17.3
gem install bundler -v 1.17.3 --no-rdoc --no-ri
# Add require 'openssl' to .../versions/1.9.3-p551/bin/bundle file right under require 'rubygems'
# This command below will do it automatically for you as long as you provide it the correct file path
sed "/^require .*/a require 'openssl'" -i "PATH_TO_RBENV_DIR_HERE/versions/1.9.3-p551/bin/bundle"
# That's it! Run commands below to ensure you have patched Ruby 1.9.3-p551
rbenv rehash
curl -Lks 'https://git.io/rg-ssl' | ruby
Now that's out of the way, you can try installing rake 10.5.0
gem install rake -v 10.5.0 --no-ri --no-rdoc
A Gemfile.lock would avoid this problem. If you had one from the last time you ran this code, it would still have the appropriate versions for Rails 3 and Ruby 1.9. Bundler would follow the Gemfile.lock. Unfortunately back then it was not the practice to commit Gemfile.lock.
Since you don't have a Gemfile.lock you're in dependency hell. Bundler is trying to resolve the dependencies using each gem's own gemspec. It doesn't matter which gems you have installed. Where versions are specified it will use that. Where they are not, it will try to use the latest version. Most gems aren't thinking about Ruby 1.9 any more, or old versions of gems didn't have good dependency specifications, so there's going to be problems.
For example, Rails 3.0.0's rails.gemspec depends on railties 3.0.0. railties 3.0.0's railties.gemspec depends on rake >= 0.8.4. There's no upper bound, so Bundler grabs the latest rake and it doesn't work with Ruby 1.9.
To solve this you will need to add more versioned dependencies to your Gemfile. For example, rake 11 should work with Ruby 1.9. Try adding this to your Gemfile.
gem 'rake', '~> 11'
Or you can be super conservative and specify the exact versions you have installed.
gem 'rake', '0.9.2.2'
Run bundle. This should get you past rake and onto the next dependency problem. Add a version restriction for that and bundle. Continue until there's no more dependency issues. Check in the Gemfile.lock.
I am trying to use VS Code for debugging a Ruby on Rails application. I have installed both the Ruby and Rubocop extension into VS Code. Then I have installed ruby-debug-ide -v 0.6.0 and debase -v 0.2.1 both via sudo gem install and rvmsudo gem install. However, when trying to debug the application using Rails server, I get the following exception:
/usr/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs'
:
Could not find 'ruby-debug-ide' (>= 0.a) among 48 total gem(s)
(
Gem::LoadError
)
Checked in 'GEM_PATH=/home/myname/.rvm/gems/ruby-2.3.1:/home/myname/.rvm/gems/ruby-2.3.1#global', execute `gem env` for more information
from /usr/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
from /usr/local/bin/rdebug-ide:22:in `<main>'
However, when I list all installed gems with rvm all do gem list, neither of the installed gems are there:
*** LOCAL GEMS ***
...
concurrent-ruby (1.0.2)
did_you_mean (1.0.0)
erubis (2.7.0)
...
rdoc (4.2.1)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
...
Does anybody know how to fix this?
In my case, the solution was quite simple. As a newbie in Ruby on Rails, I did not realize that instead of installing gems into Ruby root, I should specify them in my Gemfile. So, inside Gemfile I put only:
group :development do
gem 'ruby-debug-ide', '0.6.0'
gem 'debase', '0.2.1'
gem 'web-console', '~> 2.0'
gem 'spring'
end
and this solved the issue for me.
I also had this issue for a while, there doesn't seem to be a clear cut way of resolving this problem. All I had to do was run vs code through the terminal and I could debug my rails project, assuming you are using Linux. Just make sure you don't open vs code via a shortcut.
getting error on rails new myapp
/home/high-tech/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'railties' (>= 0) among 19 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/home/high-tech/.rvm/gems/ruby-2.2.3:/home/high-tech/.rvm/gems/ruby-2.2.3#global', execute `gem env` for more information
from /home/high-tech/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
from /home/high-tech/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /home/high-tech/.rbenv/versions/2.2.0/bin/rails:22:in `<main>'
Rails' dependencies might not be correctly installed.
Try the following:
bundle show railties
If it fails:
gem install railties
to install the gem.
Hope it helps.
I installed Rails using http://railsinstaller.org/ on my windows 7 machine.
I had problem with mysql2 gem, but it have been solved by downloading mysql C connector and using custom key:
C:\Users\lenovo>gem install mysql2 -- --with-mysql-dir=c:\mysql-connector-c-6.1.
3-win32
For now I am stuck with this error:
C:\Dropbox\xcams\ror>ruby script\rails
←[31mCould not find gem 'sass-rails (~> 3.2.3) x86-mingw32' in the gems availabl
e on this machine.←[0m
←[33mRun `bundle install` to install missing gems.←[0m
If I reinstall gem no errors:
C:\Dropbox\xcams\ror>gem install "sass-rails"
Successfully installed sass-rails-4.0.1
1 gem installed
Installing ri documentation for sass-rails-4.0.1...
Installing RDoc documentation for sass-rails-4.0.1...
Check that gem in the list:
C:\Dropbox\xcams\ror>gem list | findstr sass
sass (3.2.13)
sass-rails (4.0.1)
Try to start. Same error again:
C:\Dropbox\xcams\ror>ruby script\rails
←[31mCould not find gem 'sass-rails (~> 3.2.3) x86-mingw32' in the gems availabl
e on this machine.←[0m
←[33mRun `bundle install` to install missing gems.←[0m
How properly install this gem on winodws?
My environment:
C:\Users\lenovo>ruby -v
ruby 1.9.3p484 (2013-11-22) [i386-mingw32]
C:\Users\lenovo>gem -v
1.8.28
C:\Users\lenovo>rails -v
Rails 4.0.2
Notice the different versions. Try to enforce the version you have installed on the Gemfile:
`gem "sass-rails", "4.0.1"`
Problem was with my IDE (Intellij Idea 13)
When I generate RoR app from console all works fine.
im installing rails on ubuntu 12.04. installed manualy, using this method:
How do I install ruby 2.0.0 correctly on Ubuntu 12.04?
then:
gem update --system
gem install rails
now if i run command "rails" the output is as following:
/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'thread_safe' (~> 0.1) - did find: [thread_safe-0.1.2-java] (Gem::LoadError)
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1265:in `block in activate_dependencies'
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1254:in `each'
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1254:in `activate_dependencies'
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1236:in `activate'
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1268:in `block in activate_dependencies'
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1254:in `each'
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1254:in `activate_dependencies'
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1236:in `activate'
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:48:in `gem'
from /usr/local/bin/rails:22:in `<main>'
edit:
yes i tryed:
gem install --version 0.1.2 thread_safe
gem uninstall thread_safe
gem install thread_safe
after reinstalling thread_safe rails gave me the same error
Seems you are using 2.1.0 version of rubygems. It's not bug of tread_safe or atomic gems, but it's bug of rubygems 2.1.0. Try to install older version (like 2.0.8). How to do this:
gem uninstall rubygems-update
gem install rubygems-update --version 2.0.8
update_rubygems
The error message says thatyou don't have thread_safe version ~>0.1, and that it found thread_safe version 0.1.2-java,but i guess this version was not compatible/satisfactory.
probably somehow the non-java version was not getting installed coz of the presence of the java version. install the gem separately.
gem install --version 0.1.2 thread_safe
so i searched for atomic gems, found atomic (1.1.14 ruby java). mine was atomic (1.1.13 java). It might be because i had no JDK 8 installed, but after installing atomic (1.1.14 ruby java) command rails gives me nice list of available parameters.
rails new test_app = success!!!