gpt4 book ai didi

ruby-on-rails - Bundle Install on dev 给出了缺少生产 gem 的错误

转载 作者:数据小太阳 更新时间:2023-10-29 08:00:06 24 4
gpt4 key购买 nike

为什么我的 gemfile 没有跳过“生产”gem?

我刚刚在 Mac OS X Mavericks 上安装了 Rails(可能是无关紧要的细节)。当我执行 bundle install 时,它给我一个关于缺少 pg gem 的错误。然而,这仅在我的 production 环境中列出,所以不应该跳过它吗?注释掉我的 gem pg 使 bundle install 成功。额外的上下文:

我刚刚在 Mac OS X Mavericks 上安装了 Rails。当我尝试打开我的项目时,它似乎认为我处于“生产”状态并尝试将我的“pg”gem 用于 Postgres。如果我尝试使用 rails srails console,我会收到错误消息,指出我没有安装“pg”,它应该只用于我的数据库的生产环境。

我遵循了本教程:http://railsapps.github.io/installrubyonrails-mac.html

我的 gem 文件:

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'

最佳答案

默认情况下,Bundler 包含所有组。您必须像这样明确排除任何您不想要的组:

bundle install --without production

第一次之后,Bundler 会记住你之前的设置,所以 production 组将在你下次运行 bundle install 时被排除在外。

关于ruby-on-rails - Bundle Install on dev 给出了缺少生产 gem 的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20894911/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com