gpt4 book ai didi

ruby-on-rails - 安装pg gem后无法启动rails server

转载 作者:行者123 更新时间:2023-11-29 13:56:09 24 4
gpt4 key购买 nike

我使用这个为 postgreSQL 安装 pg gem 后遇到问题:

subst X: "C:\Program Files (x86)\PostgreSQL\9.4"
gem install pg -- --with-pg-dir=X:
subst X: /D

在那之后,当我尝试“rails s”命令时,我得到了这个

    $ rails s
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/pg- 0.18.2/lib/pg.rb:14:in `
require': cannot load such file -- 2.1/pg_ext (LoadError)
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/pg-0.18.2/lib/
pg.rb:14:in `rescue in <top (required)>'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/pg-0.18.2/lib/
pg.rb:3:in `<top (required)>'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.5
/lib/bundler/runtime.rb:76:in `require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.5
/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.5
/lib/bundler/runtime.rb:72:in `each'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.5
/lib/bundler/runtime.rb:72:in `block in require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.5
/lib/bundler/runtime.rb:61:in `each'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.5
/lib/bundler/runtime.rb:61:in `require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.5
/lib/bundler.rb:134:in `require'
from c:/Sites/myblog/config/application.rb:7:in `<top (required)>'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8
/lib/rails/commands/commands_tasks.rb:79:in `require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8
/lib/rails/commands/commands_tasks.rb:79:in `block in server'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8
/lib/rails/commands/commands_tasks.rb:76:in `tap'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8
/lib/rails/commands/commands_tasks.rb:76:in `server'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8
/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8
/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

Imran@IMRAN-PC /c/Sites/myblog
$

此外,我还评论了 gem 'sqlite3' 并在 gemfile 中添加了 gem 'pg'。

任何帮助将不胜感激

最佳答案

尝试卸载“pg”gem:

gem uninstall pg

然后运行 ​​bundle(假设 Gemfile 包含“pg”gem):

bundle

关于ruby-on-rails - 安装pg gem后无法启动rails server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31403282/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com