rake db:迁移 postgreSQL

发布于 2024-10-09 14:37:09 字数 1668 浏览 1 评论 0原文

我终于安装了 gem pg。现在,当我去迁移数据库时,我得到以下信息:

$ rake db:migrate
(in c:/rubyDev/bsbaslic)
rake aborted!
no such file to load -- 1.9/pg_ext
c:/Ruby192/lib/ruby/gems/1.9.1/gems/pg-0.10.0/lib/pg.rb:10:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/pg-0.10.0/lib/pg.rb:10:in `<top (required)>'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `block (2 levels) in require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `each'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `block in require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `each'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler.rb:112:in `require'
c:/rubyDev/bsbaslic/config/application.rb:7:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
c:/rubyDev/bsbaslic/Rakefile:4:in `<top (required)>'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `load'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:1991:in `run'
c:/Ruby192/bin/rake:31:in `<main>'

有人对它正在寻找的内容有任何想法吗?我在与 pg.rb 相同的目录中有一个 pg_ext.so 文件。

I finally got the gem pg to install. Now when I go to migrate the database I get the following:

$ rake db:migrate
(in c:/rubyDev/bsbaslic)
rake aborted!
no such file to load -- 1.9/pg_ext
c:/Ruby192/lib/ruby/gems/1.9.1/gems/pg-0.10.0/lib/pg.rb:10:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/pg-0.10.0/lib/pg.rb:10:in `<top (required)>'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `block (2 levels) in require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `each'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `block in require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `each'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler.rb:112:in `require'
c:/rubyDev/bsbaslic/config/application.rb:7:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
c:/rubyDev/bsbaslic/Rakefile:4:in `<top (required)>'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `load'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:1991:in `run'
c:/Ruby192/bin/rake:31:in `<main>'

Does anybody have any ideas as to what it is looking for? I have a pg_ext.so file in the same directory as pg.rb.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

月下凄凉 2024-10-16 14:37:09

Windows 程序无法加载 .so 文件 - 它们而是加载 .dll 文件。您需要为 Windows 编译的 pg 版本,或者您需要在 Linux 环境(例如 msys 或 cygwin)中运行 Ruby。

Windows programs cannot load .so files - they load .dll files instead. You need a build of pg compiled for Windows, or you need to be running Ruby from within a Linuxy environment such as msys or cygwin.

对岸观火 2024-10-16 14:37:09

问题出在你的 pg gem 版本上。有一个针对 windows pg 0.9.0 的特殊版本。
为了让它在 Windows 上运行:

  1. 卸载当前的 pg 0.10.0
  2. 安装 pg,如下所示:gem install pg --version=0.9.0 -- --with-pg-config=/short/path /到/postresql/bin
    (要获得短路径,您只需将目录更改为 PostgrSQL bin,然后在 cmd 中输入 command,它会自动将路径更改为短版本)

  3. 然后编辑您的项目 Gemfile 以使用正确的pg gem 版本 (0.9.0)

就是这样。

祝你好运

The problem is in your version of pg gem. There is a special version for windows pg 0.9.0.
In order to have it workingon windows:

  1. uninstall the current pg 0.10.0
  2. install pg as follows: gem install pg --version=0.9.0 -- --with-pg-config=/short/path/to/postresql/bin
    (To get short path you can simply change directory to PostgrSQL bin and then type command in cmd, it will automaticaly change path to a short verison)

  3. Then edit your project Gemfile in order to use correct pg gem version (0.9.0)

And that's it.

Good Luck

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文