Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundle Install on dev giving an error that a production gem is missing

Why is my gemfile not skipping over "production" gems?

I just installed Rails on Mac OS X Mavericks (possibly an irrelevant detail). When I do bundle install, it gives me an error about missing pg gem. However this is only listed in my production environment, so shouldn't it be skipped? Commenting out my gem pg makes bundle install successful. Extra context:

I just installed Rails on Mac OS X Mavericks. When I try to open my project, it seems to think I'm in "production" and tries to use my "pg" gem for Postgres. If I try to use rails s or rails console, I get the error that I haven't installed "pg" which should only be used in production for my DB.

I followed this tutorial: http://railsapps.github.io/installrubyonrails-mac.html

My gemfile:

source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0

gem 'rails', '4.0.0'
gem 'bootstrap-sass', '~> 3.0.1.0.rc'
gem 'bcrypt-ruby', '3.0.1'
# generates names, email addresses, and other placeholders for factories.
gem 'faker'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'aws-sdk', '1.11.1'
gem 'd3-rails', '~>3.3.7'
# used for file ajax uploads
gem 'remotipart', '~> 1.2'
# used for making server side variables accessible in JS

gem 'gon', '4.1.1'
gem "introjs-rails"
# High voltage for static pages
gem 'high_voltage', '~> 2.0.0'
gem "koala", "~> 1.8.0rc1"
gem 'acts_as_list'

group :development, :test do
  gem 'sqlite3', '1.3.8'
  # rspec-rails includes RSpec itself in a wrapper to make it play nicely with Rails.
  gem 'rspec-rails'
  # replaces Rails' default fixtures for feeding test data to the test suite with much more preferable factories
  gem 'factory_girl_rails'
  # watches your application and tests and runs specs for you automatically when it detects changes.
  gem 'guard-rspec'
  gem 'spork-rails', '4.0.0'
  gem 'guard-spork', '1.5.0'
  gem 'childprocess', '0.3.6'
end

group :test do
    gem 'selenium-webdriver'
  # makes it easy to programatically simulate your users' interactions with your application
    gem 'capybara'
  gem 'factory_girl_rails'
  gem 'guard-rspec' # tims tutorial
  # opens your default web browser upon failed integration specs to show you what your application is rendering.
  gem 'launchy' # tims tutorial
  # helps clear out db after using selenium in tests
  gem 'database_cleaner' # tims tutorial
end

gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
# added for resizing panes on d3fiddle pages
gem 'jquery-ui-rails'
# added for code highlighting on d3fiddle pages
gem 'codemirror-rails'

group :doc do
  gem 'sdoc', '0.3.20', require: false
end

group :production do
    gem 'pg', '0.15.1'
    gem 'rails_12factor', '0.0.2'
end

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]
gem 'omniauth-facebook', '1.4.0'
like image 488
Don P Avatar asked Dec 06 '25 06:12

Don P


1 Answers

By default, Bundler includes all groups. You have to explicitly exclude any groups you don't want like so:

bundle install --without production

After the first time, Bundler will remember your previous setting, so the production group will be excluded next time you run bundle install.

like image 121
davogones Avatar answered Dec 08 '25 19:12

davogones



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!