rake db:迁移 postgreSQL
我终于安装了 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Windows 程序无法加载
.so
文件 - 它们而是加载.dll
文件。您需要为 Windows 编译的pg
版本,或者您需要在 Linux 环境(例如 msys 或 cygwin)中运行 Ruby。Windows programs cannot load
.so
files - they load.dll
files instead. You need a build ofpg
compiled for Windows, or you need to be running Ruby from within a Linuxy environment such as msys or cygwin.问题出在你的 pg gem 版本上。有一个针对 windows pg 0.9.0 的特殊版本。
为了让它在 Windows 上运行:
安装 pg,如下所示:gem install pg --version=0.9.0 -- --with-pg-config=/short/path /到/postresql/bin
(要获得短路径,您只需将目录更改为 PostgrSQL bin,然后在 cmd 中输入 command,它会自动将路径更改为短版本)
然后编辑您的项目 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:
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)
Then edit your project Gemfile in order to use correct pg gem version (0.9.0)
And that's it.
Good Luck