ruby-on-rails - "rake db:migrate"结果为 "The bundle currently has pg locked at 0.18.4"

标签 ruby-on-rails ruby pg sqlite3-ruby

我在 Rails 中生成了这个脚手架。然后我做了一个“rake db:migrate”。然后我得到:

[31mYou have requested:
pg >= 0
The bundle currently has pg locked at 0.18.4.
Try running `bundle update pg`[0m
[33mRun `bundle install` to install missing gems.[0m

然后我做了“bundle update”和“bundle install”,结果是:

安装带有 native 扩展的 pg 0.18.4 C:/jruby-9.0.4.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:39: warning: Tempfile#unlink or delete called on open file;忽略

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

C:/jruby-9.0.4.0/bin/jruby.exe -r ./siteconf20151205-6108-1bkqm97.rb     >extconf.rb
NotImplementedError: C extensions are not supported
<top> at C:/jruby-9.0.4.0/lib/ruby/stdlib/mkmf.rb:1
require at org/jruby/RubyKernel.java:939
(root) at     C:/jruby>9.0.4.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
<top> at extconf.rb:2
extconf failed, exit code 1
Gem files will remain installed in C:/jruby-    9.0.4.0/lib/ruby/gems/shared/gems/pg-0.18.4 for inspection.
Results logged to C:/jruby-    9.0.4.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.2.0/pg-    0.18.4/gem_make.out
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.

在我的 Gemfile 中,我尝试使“gem 'pg'”变得简单,然后“捆绑安装”,但仍然收到错误消息。

这是我的 Gemfile:

source 'https://rubygems.org'  
group :production do  
gem 'rails_12factor'  
gem 'pg'  
end  
group :development, :test do  
gem 'sqlite3'  
end  
gem 'sass-rails', '~> 4.0.3'  
gem 'uglifier', '>= 1.3.0'  
gem 'coffee-rails', '~> 4.0.0'  
gem 'jquery-rails'  
gem 'turbolinks'  
gem 'jbuilder', '~> 2.0'  
gem 'sdoc', '~> 0.4.0',          group: :doc  
gem 'tzinfo-data', platforms: [:mingw, :mswin]  
gem 'coffee-script-source', '1.8.0'  

最佳答案

看起来您在运行 jRuby 的 Windows 机器上。尝试使用以下 gem 之一代替 pg:

https://github.com/jruby/activerecord-jdbc-adapter

https://github.com/headius/jruby-pg

这个答案也可能有帮助: unable to install pg gem

关于ruby-on-rails - "rake db:migrate"结果为 "The bundle currently has pg locked at 0.18.4",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34112464/

相关文章:

ruby-on-rails - rails 单元测试失败 "undefined method ' 请求 ='"

ruby-on-rails - Rails 3.1,RSpec : testing model validations

ruby - ActiveRecord 连接警告。 (数据库连接不会自动关闭)

ruby-on-rails - 如何使用 PG gem 捕获 PSQL 命令的输出?

ruby - gem install pg 不适用于 OSX Lion

ruby-on-rails - rails 2.3.10 open_session - 缺少方法

ruby-on-rails - 有没有办法在 Ruby 中用尾随逗号解析 JSON?

ruby-on-rails - ImageMagick - "CORE_RL_magick_.dll not found"或如何使用 ruby​​ 1.9.2 在 Windows 上安装 RMagick

c# - 如果不是用什么语言,如何实现我想用 c# 发明的这个新的事件处理程序系统?

ruby - 如何使用 PostgreSQL 和 Ruby 将数据库表中的列名提取到数组中?