ruby-on-rails – 您的Gemfile不止一次列出gem.可能会导致错误

ruby-on-rails – 您的Gemfile不止一次列出gem.可能会导致错误,第1张

概述我正在运行bundle install时收到以下这些消息 Your Gemfile lists the gem sqlite3 (= 1.3.5) more than once.You should probably keep only one of them.While it's not a problem now, it could cause errors if you change t 我正在运行bundle install时收到以下这些消息

Your Gemfile Lists the gem sqlite3 (= 1.3.5) more than once.You should probably keep only one of them.While it's not a problem Now,it Could cause errors if you change the version of just one of them later.Your Gemfile Lists the gem rspec-rails (= 2.10.0) more than once.You should probably keep only one of them.While it's not a problem Now,it Could cause errors if you change the version of just one of them later.Your Gemfile Lists the gem pg (= 0.12.2) more than once.You should probably keep only one of them.While it's not a problem Now,it Could cause errors if you change the version of just one of them later.

我在Heroku中使用Postgresql,我相信我在开发和测试中都使用Postgresql.我最近从sqlite迁移/切换到postgresql.

我是否还需要sqlite3 gems:development或in:development,:test?

最后,开发与发展是否有区别? :开发,:测试?

database.yml的

development:  adapter: postgresql  enCoding: unicode  database: xxxxxx_development  pool: 5  username: xxxxxx  password:test:  adapter: postgresql  enCoding: unicode  database: xxxxxx_development  pool: 5  username: xxxxxx  password:

的Gemfile

gem 'rails','3.2.11'gem "bootstrap-sass"gem 'will_paginate'gem 'bootstrap-will_paginate','0.0.6'gem 'pg','0.12.2'gem 'pg_search'group :development,:test do  gem 'sqlite3','1.3.5'  gem 'rspec-rails','2.10.0'  gem 'guard-rspec','0.5.5'endgroup :development do  gem 'sqlite3','2.10.0'end# Test gems on Macintosh OS Xgroup :test do  gem 'rspec-rails','2.10.0'endgroup :production do  gem 'pg','0.12.2'  gem 'rack-Google_analytics'end
解决方法 您正在重复在此处的开发组中添加sqlite:

group :development,'2.10.0'end

你可以在这里删除你的第二个开发组列表,因为它没有添加任何东西 – 你已经在第一个语句中将它们放入开发和测试中.类似地,通过将​​pg放在任何组之外,它可以在所有组中使用,因此将其添加到生产中是一个重复的列表.

重写你的gemfile可能是:

gem 'rails','0.0.6'# gem 'pg','2.10.0'endgroup :test do  gem 'guard-rspec','0.5.5'endgroup :production do  gem 'pg','0.12.2'  gem 'rack-Google_analytics'end

另外,一个感受到痛苦的人的一个友好提示:尝试在开发中使用相同的db作为生产.我知道最初在本地设置postgres可能会很棘手,但是一旦它在那里它就会坚如磐石并且非常容易使用.由于PG和sqlite实现之间的差异(例如,在字段iirc中搜索文本),您将面临更少的错误风险.

没有sqlite:

gem 'rails',:test do  gem 'rspec-rails','0.5.5'endgroup :production do  gem 'rack-Google_analytics'end
总结

以上是内存溢出为你收集整理的ruby-on-rails – 您的Gemfile不止一次列出gem.可能会导致错误全部内容,希望文章能够帮你解决ruby-on-rails – 您的Gemfile不止一次列出gem.可能会导致错误所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1291004.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存