Rails 4 - Bundler could not find compatible versions for gem "railties" - ruby

I'm having some incompatibility issues with rails and coffee-rails:
Bundler could not find compatible versions for gem "railties":
In Gemfile:
rails (= 4.0.0) x86-mingw32 depends on
railties (= 4.0.0) x86-mingw32
coffee-rails (= 4.0.0) x86-mingw32 depends on
railties (4.0.1)
Here is my Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
# Version required for this application
gem 'rails', '4.0.0' # Rails framework
gem 'bootstrap-sass', '2.3.2.0' # Used for advanced CSS: open-source Sass add on from Twitter
gem 'bcrypt-ruby', '3.0.1' # Used for password encryption
gem 'pg', '0.15.1' # Used for connection to Postgres
gem 'jquery-ui-rails' # Used to create user interfaces
gem 'crypt' # Used for message encryption
gem 'http_parser.rb', '0.6.0.beta.2' # EM-Websocket dependancy
gem 'eventmachine' # EM-Websocket dependancy
group :assets do
gem 'haml_coffee_assets' # Used for Coffescript template generation
gem 'execjs' # Javascript helper
end
group :development, :test do # Groups define the environment in which the Gem will be needed
gem 'rspec-rails', '2.13.1' # Used for testing/TDD
gem 'guard-rspec', '2.5.0' # Used for automated RSpec testing
end
group :test do # Used within the test environment
gem 'selenium-webdriver', '2.0.0' # Used with RSpec to create automated tests
gem 'capybara', '2.1.0' # Adds more natural syntax to RSpec test scripts, and allows webpage tests
gem 'libnotify', '0.8.0' # Automatic notifications of Guard RSpec test results
gem 'spork-rails' # Used to speed up testing
gem 'guard-spork', '1.5.0' # Required for Guard/Spork compatibility: autostarts a Spork server with Guard
gem 'childprocess', '0.3.6' # Controls external programs
gem 'factory_girl_rails', '4.2.1' # Used mainly for testing Model management
end
gem 'sass-rails', '4.0.0' # Advanced CSS styling
gem 'uglifier', '2.1.1' # minifies Javascript code
gem 'coffee-rails', '4.0.0' # Allows CoffeeScript to adapt to the Assets pipeline
gem 'coffee-script-source', '1.5.0'
gem 'jquery-rails', '2.2.1' # Advanced Javascript functions: added ease of use
gem 'turbolinks', '1.1.1' # Makes following links faster: uses Assets pipeline
gem 'jbuilder', '1.0.2' # Creates JSON structures
group :doc do # required gem
gem 'sdoc', '0.3.20', require: false
end
group :production do # used only within deployment
gem 'rails_12factor', '0.0.2'
end
And gem list railties shows:
PS C:\Users\HP\Ubuntu One\A2 Computing Project\Software Development\Client> gem list railties
*** LOCAL GEMS ***
railties (4.0.1, 4.0.0)
The answer to a previous question I found said that running gem install railties fixed it, but it didnt for me. Any help?

try running bundle update if you had a older version of railtie before.

Related

How do you convert a jruby-based application to ruby?

I made an application using jruby but I want to get it to work on a different computer which only has ruby installed.
It won't let me just change the gemfile from jruby to ruby, so how can I change it to run based on ruby?
This is my gemfile using jruby:
source 'https://rubygems.org'
ruby '2.2.2', :engine => 'jruby', :engine_version => '9.0.0.0'
gem 'cowsay'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use postgresql as the database for Active Record
gem 'activerecord-jdbcpostgresql-adapter'
gem 'rails_12factor', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
gem 'puma'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
change this:
ruby '2.2.2', :engine => 'jruby', :engine_version => '9.0.0.0'
to:
ruby '2.2.2'
and change:
gem 'activerecord-jdbcpostgresql-adapter'
to:
gem 'pg'
You probably need to update you database.yml also. You didn't paste it here, so I can't be sure. Just lookup the pg gem to see what you need to configure your conetions to.
no need to actually change much stuff as suggested in the other answer.
in the Gemfile specify platform qualifiers for MRI/JRuby specific gems :
# ruby '2.2.2', :engine => 'jruby', :engine_version => '9.0.0.0'
# ...
gem 'rails', '4.1.8'
# ...
gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby
gem 'pg', platform: :mri
if you're not using anything AR-JDBC specific in database.yml (e.g. url: jdbc:postrgresql:...) than the same configuration with work on JRuby as well as C-Ruby

jruby Bundler could not find compatible versions json

New to jruby. I am getting error when trying to run
jruby -S bundle exec rake assets:precompile
Bundler could not find compatible versions for gem "json":
In snapshot (Gemfile.lock):
json (1.8.1)
In Gemfile:
carrierwave (>= 0) ruby depends on
json (>= 1.7) ruby
I have tried removing Gemfile.lock and run "jruby -S bundle install", did not help.
I am using jruby 1.7.3 and ruby 1.8.7 on a Mac. I have successfully run precompile before and have not made any changes to the Gemfile.
My Gemfile (has not been changed since last Oct., used to work):
source 'https://rubygems.org'
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'activerecord-jdbcmysql-adapter'
gem 'jruby-openssl'
gem 'mini_magick'
gem 'carrierwave'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'bourbon'
#gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyrhino'
gem 'uglifier', '>= 1.0.3'
end
gem 'uuidtools'
gem 'amazon-ses-mailer'
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
Thanks
This looks like a bundler issue. Update Bundler to 1.5.2 and trying again:
jruby -S gem install bundler

Configure Rails 4, MongoDB, Cucumber, Capybara

I am currently in the process of setting up my first Mongodb, Rails 4 environment and need to configure the gem before running bundle install. Here is my gem file.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
# User mongoid for database.
gem 'mongoid', github: 'mongoid/mongoid'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :test do
gem 'cucumber-rails', :require => false
gem 'capybara'
#database_cleaner is not required, but highly recommended
gem 'database_cleaner'
end
It seems Mongo wont install as I cannot find the Mongo:Config file.
The config file is generated by running the following command:
rails g mongoid:config
Please read the mongoid documentation, it is quite good.

Rack dependencies preventing thin start

.rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:31:in `block in setup': You have already activated rack 1.4.0,
but your Gemfile requires rack 1.2.5. Using bundle exec may solve this. (Gem::LoadError)
Is the error that I get when I try to run thin start , bundle exec thin, rails s on any of my apps. I have tried running system level and app level bundle updates/ installs, removing gemfile.lock and updating again. Sudo level installs. Nothing.
Any advice?
This is my gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.10'
gem 'rake', '0.8.7'
gem 'jquery-rails', '0.2.6'
gem 'pg', :require => 'pg'
gem 'devise'
gem 'nifty-generators'
gem 'mocha'
gem 'thin'
gem 'omniauth'
require 'oauth2'
gem 'fb_graph'
gem 'nokogiri'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'gravatar_image_tag', '1.0.0.pre2'
gem 'will_paginate', '3.0.pre2'
group :development do
gem 'rspec-rails', '2.5.0'
gem 'faker', '0.9.5'
end
group :test do
gem 'rspec', '2.5.0'
gem 'webrat', '0.7.1'
gem 'spork', '0.9.0.rc5'
gem 'factory_girl_rails', '1.0'
end
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
You can try adding an .rvmrc in your project root with this content:
rvm ruby-1.9.3-head#your-project-name
After that, restart your console session. RVM will ask for permission to use the file. After that, your project will run under it's own gemspace. Run bundle again, and it will install only the required gems.

Could not find sprockets-2.0.0.beta.10 in any of the sources

I am specifically intertested in #270. You can see it here: http://railscasts.com/episodes/270-authentication-in-rails-3-1
I've downloaded the code, unzipped it and I'm in the auth-before directory.
I run bundle install and I get
Fetching source index for http://rubygems.org/
Could not find sprockets-2.0.0.beta.10 in any of the sources
I've tried fixing it my self and I've gotten this:
Bundler could not find compatible versions for gem "sprockets":
In Gemfile:
sprockets (~> 2.0) ruby
sass-rails (~> 3.1.0.rc) ruby depends on
sprockets (2.0.0.beta.10)
My gem file looks like this:
source 'http://rubygems.org'
gem 'rails', '3.1.0.rc4'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Asset template engines
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-script'
gem 'uglifier'
gem 'jquery-rails'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test do
# Pretty printed test output
gem 'turn', :require => false
end
What should I do to resolve this?
update:
I followed the suggestion below and removed the version number from sass-rails. When I run the update command I get the following:
Bundler could not find compatible versions for gem "railties":
In Gemfile:
sass-rails (>= 0) ruby depends on
railties (~> 3.1.0) ruby
rails (= 3.1.0.rc4) ruby depends on
railties (3.1.0.rc4
Remove the version limitation on sass-rails from your Gemfile, then run
bundle update sprockets sass-rails
Both sass-rails and sprockets have a stable release now.

Resources