我正在尝试将旧项目更新为新的Rails版本,当我尝试在本地以调试方式运行它时出现此错误
正如您在上面看到的,我正在使用Windows。该项目现在具有ruby版本ruby-2.4.4-p296
我试图重新安装gem并运行bundle install / update,但是它不起作用...
感谢您的帮助。预先感谢
宝石文件:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails'
# Use postgresql as the database for Active Record
gem 'pg', '0.20.0'
gem 'bootstrap-sass', '~> 3.3.7'
gem 'font-awesome-rails', '4.7.0.1'
#gem 'puma'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.4'
gem 'simple_form'
#https://github.com/mileszs/wicked_pdf
gem 'wicked_pdf'
gem 'newrelic_rpm'
gem 'wkhtmltopdf-heroku'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
gem 'nokogiri', '~> 1.8.2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
#gem install rdoc -v '6.0.4'gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Fast Debugger (ruby-debug-ide 0.6.1.beta2, debase 0.2.2, file filtering is supported) listens on 0.0.0.0:3970
Uncaught exception: There was an error while trying to load the gem 'pg'.
Gem Load Error is: undefined method `add_dll_directory' for RubyInstaller:Module
Backtrace for gem load error is:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/pg-0.20.0-x64-mingw32/lib/pg.rb:14:in `block in <top (required)>'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/pg-0.20.0-x64-mingw32/lib/pg.rb:24:in `rescue in <top (required)>'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/pg-0.20.0-x64-mingw32/lib/pg.rb:3:in `<top (required)>'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler/runtime.rb:81:in `require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler/runtime.rb:76:in `each'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler/runtime.rb:76:in `block in require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler/runtime.rb:65:in `each'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler/runtime.rb:65:in `require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler.rb:114:in `require'
C:/Users/Adrian/RubymineProjects/peluqueria-inspinia/config/application.rb:7:in `<top (required)>'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:78:in `require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:78:in `block in server'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:75:in `tap'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:75:in `server'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands.rb:17:in `<top (required)>'
C:/Users/Adrian/RubymineProjects/peluqueria-inspinia/bin/rails:4:in `require'
C:/Users/Adrian/RubymineProjects/peluqueria-inspinia/bin/rails:4:in `<top (required)>'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ruby-debug-ide-0.6.1.beta2/lib/ruby-debug-ide.rb:88:in `debug_load'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ruby-debug-ide-0.6.1.beta2/lib/ruby-debug-ide.rb:88:in `debug_program'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ruby-debug-ide-0.6.1.beta2/bin/rdebug-ide:130:in `<top (required)>' -e:1:in `load'-e:1:in `<main>'
捆绑器错误回溯:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler/runtime.rb:84:in `rescue in block (2 levels) in require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler/runtime.rb:80:in `block (2 levels) in require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler/runtime.rb:76:in `each'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler/runtime.rb:76:in `block in require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler/runtime.rb:65:in `each'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler/runtime.rb:65:in `require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.17.0.pre.1/lib/bundler.rb:114:in `require'
C:/Users/Adrian/RubymineProjects/peluqueria-inspinia/config/application.rb:7:in `<top (required)>'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:78:in `require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:78:in `block in server'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:75:in `tap'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:75:in `server'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands.rb:17:in `<top (required)>'
C:/Users/Adrian/RubymineProjects/peluqueria-inspinia/bin/rails:4:in `require'
C:/Users/Adrian/RubymineProjects/peluqueria-inspinia/bin/rails:4:in `<top (required)>'
以退出代码0结束的过程
我认为问题是gem'pg'的版本,但是我不知道应该放哪个版本
答案 0 :(得分:0)
pg-0.20.0与较新的RubyInstaller版本不兼容。您必须至少更新到pg-0.21.0。最好删除Gemfile
中pg的版本要求,以便将其更新为bundler update
上的最新兼容版本。另请参见pg changelog。