"rake db:migrate" 结果 "The bundle currently has pg locked at 0.18.4"
"rake db:migrate" results in "The bundle currently has pg locked at 0.18.4"
我在 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" 结果是:
安装带有本机扩展的 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'" 设为普通,然后 "bundle install"ing,但仍然收到错误消息。
这是我的 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'
看起来您使用的是 Windows 机器 运行 jRuby。尝试使用以下 gem 之一代替 pg:
https://github.com/jruby/activerecord-jdbc-adapter
https://github.com/headius/jruby-pg
这个答案也可能有帮助:
unable to install pg gem
我在 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" 结果是:
安装带有本机扩展的 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'" 设为普通,然后 "bundle install"ing,但仍然收到错误消息。
这是我的 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'
看起来您使用的是 Windows 机器 运行 jRuby。尝试使用以下 gem 之一代替 pg:
https://github.com/jruby/activerecord-jdbc-adapter
https://github.com/headius/jruby-pg
这个答案也可能有帮助: unable to install pg gem