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.
Related
I'm trying to install ruby version 4.1.4. I'm keeping it in specific gem sets
rvm use ruby-2.1.2#rails4.1.4 --create
gem install rails --version=4.1.4
bundle install
rails -v
And I always get back 3.2.9. If I run rails -v before bundle install, I get
Could not find proper version of railties (3.2.9) in any of the
sources Run bundle install to install missing gems.
When I run bundle install, I notice the version of rails is 3.2.9. Is there a simple fix for this.
Fetching gem metadata from https://rubygems.org/.........
Using rake 10.3.2
Using i18n 0.6.11
Using multi_json 1.10.1
Installing activesupport 3.2.9
Installing builder 3.0.4
Installing activemodel 3.2.9
Using erubis 2.7.0
Installing journey 1.0.4
Installing rack 1.4.5
Installing rack-cache 1.2
Using rack-test 0.6.2
Using hike 1.2.3
Using tilt 1.4.1
Installing sprockets 2.2.2
Installing actionpack 3.2.9
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Installing mail 2.4.4
Installing actionmailer 3.2.9
Installing arel 3.0.3
Installing tzinfo 0.3.40
Installing activerecord 3.2.9
Installing activeresource 3.2.9
Installing coffee-script-source 1.7.1
Installing execjs 2.2.1
Installing coffee-script 2.3.0
Installing rack-ssl 1.3.4
Using json 1.8.1
Installing rdoc 3.12.2
Using thor 0.19.1
Installing railties 3.2.9
Installing coffee-rails 3.2.2
Installing jquery-rails 3.1.1
Using bundler 1.6.5
Installing rails 3.2.9
Installing sass 3.3.11
Installing sass-rails 3.2.6
Installing sqlite3 1.3.9
Installing strong_parameters 0.2.3
Installing uglifier 2.5.3
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!
Any ideas how to get 4.1.4?
Thanks
Firstly, prefix commands with bundle exec where appropriate.
Secondly, have you tried bundle update rails? It could be your Gemfile.lock that's the problem...
Im using RVM with ruby on rails, when I do bundle install it shows a whole bunch more gems than when I do gem list? Something to do with rvm and which path its using?
bundle install
mds#db1:~/staging$ bundle
Using rake (0.9.6)
Using Ascii85 (1.0.1)
Using Platform (0.4.0)
Using open4 (1.3.0)
Using POpen4 (0.1.4)
Using activesupport (2.3.17)
Using rack (1.1.6)
Using actionpack (2.3.17)
Using actionmailer (2.3.17)
Using activerecord (2.3.17)
Using activeresource (2.3.17)
Using acts_as_audited (1.1.1)
Using addressable (2.2.8)
Using builder (3.0.0)
Using gyoku (1.0.0)
Using nokogiri (1.5.6)
Using akami (1.2.0)
Using ar-extensions (0.9.5)
Using cgi_multipart_eof_fix (2.5.0)
Using chunky_png (1.2.5)
Using cocaine (0.2.1)
Using coderay (1.0.9)
Using fssm (0.2.9)
Using sass (3.1.18)
Using compass (0.12.1)
Using daemons (1.1.9)
Using warden (0.10.7)
Using devise (1.0.6)
Using fastimage (1.2.13)
Using html_compressor (0.0.3)
Using rubyzip (0.9.8)
more gems......
Your bundle is complete!
It was installed into ./vendor/bundle
gem list
mds#db1:~/staging$ gem list
*** LOCAL GEMS ***
actionmailer (2.3.17)
actionpack (2.3.17)
activerecord (2.3.17)
activeresource (2.3.17)
activesupport (2.3.17)
bundler (1.3.5)
bundler-unload (1.0.1)
daemon_controller (1.1.4)
fastthread (1.0.7)
passenger (3.0.19)
rack (1.5.2, 1.1.6)
rails (2.3.17)
rake (10.1.0)
rubygems-bundler (1.2.2)
rvm (1.11.3.8)
this happens when you use bundle install --deployment or bundle install --path=..., it generates .bundle/config with something like this:
---
BUNDLE_FROZEN: '1'
BUNDLE_PATH: vendor/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'
it could be done by one of you coworkers or the bundler/capistrano integration:
if it was your coworker then just remove and ignore it:
rm -rf .bundle
echo '.bundle' >> .gitignore
for capistrano rvm-capistrano describes how to disable it => https://github.com/wayneeseguin/rvm-capistrano#disabling-bundle---deployment-when-using-gemsets
before doing gem list make sure you use the application's gemset:
rvm use application_ruby#application_gemset
gem list
Be sure to replace application_ruby with your ruby version string and application_gemset to the gemset that is used by your rails application
There is a hidden directory called .bundle in the root of your directory. Remove that, then run bundle again.
According to bundler documentation the current default, in ops case, may have been set to vendor/bundle, e.g. by a prior execution bundle install --path vendor/bundle:
Further bundle commands or calls to Bundler.setup or Bundler.require
will remember this location
Also check contents of $BUNDLE_PATH which shows where it's installed. Note: It's also possible it was installed to vendor/bundle via the --deployment option. See Deplyment mode 3.
As answered here, gem list will show only the gems installed using the --system option (see accepted answer and Caspar comment); use bundle list instead, to show gems installed in the application directory, i.e. via bundle install (without the --system option).
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 added to my new RoR application - gem twitter bootstrap. I used CSS stylesheets
gem "twitter-bootstrap-rails"
rails generate bootstrap:install static
I changed my GEMFILE
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem "twitter-bootstrap-rails"
end
And when I deployed my app on Heroku, I received this log
Delta compression using up to 4 threads.
Compressing objects: 100% (59/59), done.
Writing objects: 100% (70/70), 26.75 KiB, done.
Total 70 (delta 4), reused 0 (delta 0)
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.3.0.pre.5
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Installing rake (10.0.3)
Installing i18n (0.6.1)
Installing multi_json (1.5.0)
Installing activesupport (3.2.9.rc2)
Installing builder (3.0.4)
Installing activemodel (3.2.9.rc2)
Installing erubis (2.7.0)
Installing journey (1.0.4)
Installing rack (1.4.3)
Installing rack-cache (1.2)
Installing rack-test (0.6.2)
Installing hike (1.2.1)
Installing tilt (1.3.3)
Installing sprockets (2.8.2)
Installing actionpack (3.2.9.rc2)
Installing mime-types (1.19)
Installing polyglot (0.3.3)
Installing treetop (1.4.12)
Installing mail (2.4.4)
Installing actionmailer (3.2.9.rc2)
Installing arel (3.0.2)
Installing tzinfo (0.3.35)
Installing activerecord (3.2.9.rc2)
Installing activeresource (3.2.9.rc2)
Installing coffee-script-source (1.4.0)
Installing execjs (1.4.0)
Installing coffee-script (2.2.0)
Installing rack-ssl (1.3.2)
Installing json (1.7.6)
Installing rdoc (3.12)
Installing thor (0.16.0)
Installing railties (3.2.9.rc2)
Installing coffee-rails (3.2.2)
Installing commonjs (0.2.6)
Installing jquery-rails (2.1.4)
Installing less (2.2.2)
Installing less-rails (2.2.6)
Installing libv8 (3.11.8.13)
Using bundler (1.3.0.pre.5)
Installing rails (3.2.9.rc2)
Installing ref (1.0.2)
Installing sass (3.2.5)
Installing sass-rails (3.2.5)
Installing therubyracer (0.11.2)
Installing twitter-bootstrap-rails (2.2.0)
Installing uglifier (1.3.0)
Your bundle is complete! It was installed into ./vendor/bundle
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!
Post-install message from twitter-bootstrap-rails:
Important: You may need to add a javascript runtime to your Gemfile in order for bootstrap's LESS files to compile to CSS.
**********************************************
ExecJS supports these runtimes:
therubyracer - Google V8 embedded within Ruby
therubyrhino - Mozilla Rhino embedded within JRuby
Node.js
Apple JavaScriptCore - Included with Mac OS X
Microsoft Windows Script Host (JScript)
**********************************************
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
Asset precompilation completed (25.98s)
-----> Rails plugin injection
Injecting rails_log_stdout
Injecting rails3_serve_static_assets
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size: 15.9MB
-----> Launching... done, v6
http://rocky-badlands-2634.herokuapp.com deployed to Heroku
When I start my app, I receive message - "We're sorry, but something went wrong."
I think maybe it's connected with this message in log
Post-install message from twitter-bootstrap-rails:
Important: You may need to add a javascript runtime to your Gemfile in order for bootstrap's LESS files to compile to CSS.
If I use the Less stylesheets I also receive this message
Rails uses SASS instead of LESS. You will have to install the less-rails gem to have LESS support.
Following the twitter-bootstrap-rails instructions you will end up with:
gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"
installed out of the assets group. This might solve your problem.
Just add this to the Gemfile
gem 'twitter-bootstrap-rails', '2.1.3'
and then do
bundle install
and then push to heroku
I'm trying to run "bundle install" and it seems to have an issue with finding the appropriate gemfile even though I installed the gem bundler. I'm not sure what to do from here. When I run "bundle install" I get this:
C:\Users\User1\Sites\simple_cms>bundle install
Fetching gem metadata from http://rubygems.org/.........
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) x86-mingw32 depends on
bundler (~> 1.0.0) x86-mingw32
Current Bundler version:
bundler (1.1.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
So then I install the bundler gem which appears to install just fine.
C:\Users\User1\Sites\simple_cms>gem install bundler
Successfully installed bundler-1.1.3
1 gem installed
Installing ri documentation for bundler-1.1.3...
Installing RDoc documentation for bundler-1.1.3...
But even though the install for the bundler gem succeeded "bundle install" still fails:
C:\Users\User1\Sites\simple_cms>bundle install
Fetching gem metadata from http://rubygems.org/.........
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) x86-mingw32 depends on
bundler (~> 1.0.0) x86-mingw32
Current Bundler version:
bundler (1.1.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
When I run "gem list" the bundler is definitely there:
C:\Users\User1\Sites\simple_cms>gem list
*** LOCAL GEMS ***
actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
arel (3.0.2)
bigdecimal (1.1.0)
builder (3.0.0)
bundler (1.1.3)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.1)
erubis (2.7.0)
execjs (1.3.1)
hike (1.2.1)
i18n (0.6.0)
io-console (0.3)
journey (1.0.3)
jquery-rails (2.0.2)
json (1.7.0, 1.5.4)
mail (2.4.4)
mime-types (1.18)
minitest (2.5.1)
multi_json (1.3.4)
mysql2 (0.3.11 x86-mingw32)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3)
railties (3.2.3)
rake (0.9.2.2)
rdoc (3.12, 3.9.4)
rubygems-update (1.8.24)
sass (3.1.16)
sass-rails (3.2.5)
sprockets (2.1.3)
sqlite3 (1.3.6 x86-mingw32)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.4)
C:\Users\User1\Sites\simple_cms>
Try to remove your Gemfile.lock. Then run bundle check and see the output. It may ask you to run bundle install again.
It looks to me like your version of Rails (3.0.0) requires Bundler 1.0.0 -- you have a newer version.
You can install a specific version through gem install like this:
gem install bundler -v 1.0.0
I suggest you don't copy and paste whole projects.
First of all learn to use rvm or rbenv so you don't encounter conflicts with ruby versions and gems.
if your tutorial uses rails 3.0, you can put in something like
gem 'rails', '3.0.0'
in your Gemfile.
I suggest you install the latest rails version though and learn that.