“rake db:migrate”导致“该捆绑目前已锁定为0.18.4”

时间:2015-12-06 00:10:46

标签: 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

然后我做了“捆绑更新”和“捆绑安装”,结果是:

使用本机扩展安装pg 0.18.4 C:/jruby-9.0.4.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:39:警告:Tempfile #unlink或delete 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'”设为plain,然后“bundle install”,但仍然收到错误消息。

这是我的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'  

1 个答案:

答案 0 :(得分:0)

看起来你在运行jRuby的Windows机器上。尝试使用以下某个宝石而不是pg:

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

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

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