Currently I have two versions of rack installed on my computer 1.0.1 and 1.2.1
However, when I tried to push my git to Heroku, it complains
You have already activated rack 1.0.1, but your Gemfile requires rack 1.2.1. Consider using bundle exec. (Gem::LoadError)
How can I deactivate rack 1.0.1 and activate 1.2.1 instead? (I can't uninstall 1.0.1 since it's under system folder and I don't have the root password)
gem list -d rack
*** LOCAL GEMS ***
rack (1.2.1, 1.0.1)
Author: Christian Neukirchen
Rubyforge: http://rubyforge.org/projects/rack
Homepage: http://rack.rubyforge.org
Installed at (1.2.1): /Library/Ruby/Gems/1.8
(1.0.1): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
a modular Ruby webserver interface
And this is my Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.1'
gem 'sqlite3-ruby', '1.2.5'
gem 'hpricot'
gem 'gravatar_image_tag', '0.1.0'
gem 'devise', '1.1.3'
gem 'omniauth'
gem 'fb_graph'
gem 'rack', '1.2.1'
gem 'annotate-models'
gem 'webrat'
gem 'faker', '0.3.1'
gem 'will_paginate', '3.0.pre2'
You are probably using the Aspen stack, and will need to switch to Bamboo to accomplish what you're trying to do.
http://docs.heroku.com/stack
Related
I am running a standard Rails 4.2.0 app on Elastic Beanstalk. The container is the 64-bit Amazon Linux 2014.09 v1.0.9 box running Ruby 2.1.4, Puma 2.9.1 and Nginx 1.6.2.
When I push code to this environment, I get the following error in the puma.log: "You have already activated rack 1.5.2, but your Gemfile requires rack 1.6.0. Prepending bundle exec to your command may solve this."
I do not remember seeing these errors a few months ago when I was testing and it seems to be intermittent. Sometimes I push and everything works, other times I push and it fails.
https://forums.aws.amazon.com/thread.jspa?messageID=599675 suggests that there may be a bug in /opt/elasticbeanstalk/support/conf/puma.conf, but I've patched that file and the error still occurs. I've also made sure I have to have puma and rack in my Gemfile.
What is the most production ready and sustainable way to get my EC2 instances to load the right version of rack?
After a lot of trial and error, here's what worked for me.
Remove puma and rack from Gemfile. Run bundle install. Here's what my Gemfile looks like.
# Gemfile
source 'https://rubygems.org'
gem 'ahoy_matey'
gem 'aws-sdk'
gem 'bcrypt'
gem 'cancancan'
gem 'coffee-rails'
gem 'font-awesome-rails'
gem 'foundation-rails'
gem 'gibbon'
gem 'jbuilder'
gem 'jquery-infinite-pages'
gem 'jquery-rails'
gem 'kaminari'
gem 'mandrill_mailer'
gem 'modernizr-rails'
gem 'nokogiri'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'owlcarousel-rails'
gem 'paper_trail'
gem 'pg'
gem 'rails'
gem 'rails_admin'
gem 'sanitize'
gem 'sass-rails'
gem 'sentry-raven'
gem 'stripe'
gem 'twitter-typeahead-rails'
gem 'uglifier'
gem 'whenever'
group :test, :development do
gem 'dotenv-rails'
end
group :development do
gem 'spring'
end
group :doc do
gem 'sdoc'
end
In .ebextensions/ folder in your repo, create a script to install rack 1.6.0 as a local gem.
# .ebextensions/00-install-local-gems.config:
commands:
# add rack 1.6.0 to $GEM_ROOT so puma can activate it instead of rack 1.5.2
# use actual path not $GEM_ROOT because env vars are not available here
# make sure puma and rack are not in app's Gemfile or there will be blood
00_install_rack_160:
command: gem install -i /opt/rubies/ruby-2.1.4/lib/ruby/gems/2.1.0 rack -v 1.6.0
Commit Gemfile, Gemfile.lock and .ebextensions/00-install-local-gems.config into your repo. Push the code to Elastic Beanstalk.
You now should terminate all your existing instances. Elastic Beanstalk will re-create them with this updated configuration.
I can confirm the above works with 64bit Amazon Linux 2014.09 v1.2.0 and v1.0.9, both running Ruby 2.1 (Puma).
Using windows 7 ultimate and running cmd as administrator.
I have recently started working with ruby on rails and in my new rails app I'm attempting to install postgres(pg) gem and then I get a permission denied error as shown below:
C:\wamp\www\RailsApp>bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/...........
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.5.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.8
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.8
Using rack 1.5.2
Using rack-test 0.6.3
Using actionpack 4.1.8
Using mime-types 2.4.3
Using mail 2.6.3
Using actionmailer 4.1.8
Using activemodel 4.1.8
Using arel 5.0.1.20140414130214
Using activerecord 4.1.8
Using coffee-script-source 1.8.0
Using execjs 2.2.2
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.8
Using coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.2.6
Using jquery-rails 3.1.2
Errno::EACCES: Permission denied # rb_sysopen - C:/Ruby21/lib/ruby/gems/2.1.0/ge
ms/pg-0.18.1-x86-mingw32/lib/2.1/pg_ext.so
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.
I have tried
gem install pg
which leads to the same error.
However... when I try
gem install pg -mingw32
It appears successfull:
C:\wamp\www\RailsApp>gem install pg -mingw32
Fetching: pg-0.18.1-x86-mingw32.gem (100%)
Successfully installed pg-0.18.1-x86-mingw32
invalid options: -f fivefish
(invalid options are ignored)
Parsing documentation for pg-0.18.1-x86-mingw32
Installing ri documentation for pg-0.18.1-x86-mingw32
Done installing documentation for pg after 16 seconds
1 gem installed
Though after searching through several posts I fail to find a solution to how I can implement this with the gemfile to make the bundler run without errors nor find a solution to why I get the permission denied error in the first place.
Here is my current gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use postgresql as the database for Active Record
gem 'pg'
# 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
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
Note: I have tried using
gem 'pg', platform: :mingw
yet, the error still occurs.
Hope this helps as to make my problem clear and feel free to ask and I'll supply more data possible.
Any suggestions are valued and accepted, thank you.
If you are on windows, use thisgem install pg -mingw32
It looks like bundle is trying to install things in the
C:/Ruby21/lib/ruby/gems/2.1.0/ge
ms/pg-0.18.1-x86-mingw32/lib/2.1/
directory and your user (or the process that is executing bundle) does not have permission to write things to that particular directory.
I am no expert on bundle, but one troubleshooting step you could try is to run a windows command prompt as administrator explicitly. You can do this by searching for CMD, then right-clicking on it and selecting "run as administrator". This sometimes corrects file permissions issues when installing things in windows.
Given a gemfile of :
source 'https://rubygems.org'
gem 'rails', '4.1.1'
group :development, :test do
gem 'railroady'
gem 'sqlite3'
gem 'jasmine'
# For linux support
gem 'therubyracer'
end
group :production do
gem 'pg'
gem 'thin'
end
gem 'sass-rails'
# gem 'coffee-rails'
gem 'uglifier', '>= 1.0.3'
gem 'colorize'
gem 'jquery-ui-rails'
gem 'jquery-rails'
gem 'rails-backbone'
# gem 'backbone-on-rails'
gem 'bootstrap-sass'
gem 'requirejs-rails', git: 'git://github.com/jwhitley/requirejs-rails.git'
gem 'ejs'
gem 'devise'
gem 'better_errors', '>= 0.2.0', :group => :development
gem 'binding_of_caller', '>= 0.6.8', :group => :development
gem 'd3_rails'
gem 'font-awesome-sass-rails'
# for a better way of looking at the rake routes by calling rake color_routes in the console
gem 'color_routes'
# lets us know which user is logged in, and store in a global variable gon{}
gem 'gon'
#browser detection
gem 'browser'
# FOR EASY TRANISTION TO Rails 4
gem 'protected_attributes'
gem 'rails-observers'
gem 'actionpack-page_caching'
gem 'actionpack-action_caching'
and when running bundle, getting the following error:
Bundler could not find compatible versions for gem "jquery-rails":
In Gemfile:
rails-backbone (>= 0) ruby depends on
jquery-rails (~> 2.1.3) ruby
jquery-rails (3.1.2)
Bundler could not find compatible versions for gem "ejs":
In Gemfile:
rails-backbone (>= 0) ruby depends on
ejs (~> 1.0.0) ruby
ejs (1.1.1)
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails-backbone (>= 0) ruby depends on
rails (~> 3.1.0.beta1) ruby
rails (4.1.1)
The errors aren't making sense. Taking the first part with jquery-rails, i get that it is saying another gem rails-backbone of a version greater than or equal to 0 depends on jquery-rails of around 2.1.3.
What does ruby mean after the versions?
What is `jquery-rails (3.1.2) mean?
Basically, you have dependency errors in your gemfile, and it seems that rails-backbone is causing most of them, consider removing it, as the latest version works with rails 3.1 - it hasn't been updated for long time
Here is info about the gem: https://rubygems.org/gems/rails-backbone
Bundler could not find compatible versions for gem "ejs":
In Gemfile:
rails-backbone (>= 0) ruby depends on
ejs (~> 1.0.0) ruby
ejs (1.1.1)
This error literally means that you are using ejs version 1.1.1 (probably a dependency of some other gem), but rails-backbone (version greater or equal 0, so any version) requires ejs in version 1.0.*
you can use rails-backbone from the git with
gem 'rails-backbone', git: 'https://github.com/codebrew/backbone-rails.git', tag: 'v1.1.2'
Version 1.1.2 depends on any version of jquery-rails and mocha, so it shouldn't cause any problems. Using git without tag will get the latest version from master, but I would advise against using development version (may cause more trouble than good)
The rubygem seems outdated, the github repository states that it works with rails 4
As a workaround, get the gem directly from github :
gem 'rails-backbone', :git => 'https://github.com/codebrew/backbone-rails.git'
jquery-rails (~> 2.1.3) means it is dependent on all jquery-rails versions between 2.1.3 and below 2.2.0.
jquery-rails (3.1.2) is already installed in the app; it can be verified by looking at Gemfile.lock contents.
Try bundle update; it will try to update all the gem versions where there are no specific version specified, and possibly succeed in getting the dependency conflict resolved.
Hello I want to install these
gem 'activeadmin',
gem "meta_search", '>= 1.1.0.pre'
gems to my project but I got error like this
Bundler could not find compatible versions for gem "actionpack":
In snapshot (Gemfile.lock):
actionpack (4.0.2)
In Gemfile:
meta_search (>= 1.1.0.pre) ruby depends on
actionpack (~> 3.1.0.alpha) ruby
How I can solve these problems
Meta_search doesn't support rails 4. So you're getting a conflict.
Suggest you have a look at Ransack instead, which is basically a ground up rewrite of meta-search. If you're using rails 3, then you need to specify this in your Gemfile.
Active Admin has a few other dependencies as well. Check this out Active Admin install with Rails 4.
Copy and paste all the gems (in the top answer) to your gemfile and you should not have any issues running bundle.
just put
"meta_search", '>= 1.1.0.pre'
before
gem 'activeadmin'
this should solve your problem
gem 'devise', github: 'plataformatec/devise'
gem 'responders', github: 'plataformatec/responders'
gem 'inherited_resources', github: 'josevalim/inherited_resources'
gem 'ransack', github: 'ernie/ransack'
gem 'activeadmin', github: 'gregbell/active_admin'
gem 'formtastic', github: 'justinfrench/formtastic'
it's worked
I have installed jruby and trying to use Neo4j for my Rails app. But typing bundle install gives me the following conflict.
Bundler could not find compatible versions for gem "railties":
In Gemfile:
neo4j (>= 2.2.3) java depends on
railties (< 3.3, >= 3.0.0) java
rails (= 4.0.0) java depends on
railties (4.0.0)
Here's my gemfile:
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'sass-rails'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails'
gem 'therubyrhino'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'unicorn'
gem 'capistrano', group: :development
group :development, :test do
gem "rspec-rails"
end
gem "neo4j", ">= 2.2.3"
Should I remove my Gemfile.lock and run bundle update? Thanks!
There is a branch for rails 4 in the neo4j project, so you can just specify it in Gemfile:
gem 'neo4j', git: 'git://github.com/andreasronge/neo4j.git', branch: 'rails4'
That says that the currently available version of neo4j require a version of railties < 3.3, but rails 4.0.0 requires version 4.0.0 of railties: bundler cannot resolve this conflict.
The only way out of this is for neo4j to be updated to work with rails 4.0. It is entirely possible that neo4j's version constraint on railties is a precaution only - there may be nothing more to do than checking that everything still works under 4.0.