2016-01-31 43 views
1

我想在目錄50web\servers\dev運行命令薄找不到pg_ext

thin -R lat.ru start 

lat.ru是開源項目50web的一部分)。

我得到以下錯誤:

D:\dev\derek\50web\servers\dev>thin -R lat.ru start 
C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': ca 
nnot load such file -- 2.1/pg_ext (LoadError) 
     from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in 
`require' 
     from C:/Ruby21/lib/ruby/gems/2.1.0/gems/pg-0.18.4/lib/pg.rb:14:in `rescu 
e in <top (required)>' 
     from C:/Ruby21/lib/ruby/gems/2.1.0/gems/pg-0.18.4/lib/pg.rb:3:in `<top (
required)>' 
     from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in 
`require' 
     from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in 
`rescue in require' 
     from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in 
`require' 
     from C:/Ruby21/lib/ruby/site_ruby/2.1.0/getdb.rb:11:in `<top (required)> 
' 
     from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in 
`require' 
     from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in 
`require' 
     from D:/dev/derek/50web/routes/lat.rb:2:in `<top (required)>' 
     from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in 
`require' 
     from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in 
`require' 
     from lat.ru:3:in `block in <main>' 
     from C:/Ruby21/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:5 
5:in `instance_eval' 
     from C:/Ruby21/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:5 
5:in `initialize' 
     from lat.ru:1:in `new' 
     from lat.ru:1:in `<main>' 
     from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/lib/rack/adapter/load 
er.rb:33:in `eval' 
     from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/lib/rack/adapter/load 
er.rb:33:in `load' 
     from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/lib/thin/controllers/ 
controller.rb:182:in `load_rackup_config' 
     from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/lib/thin/controllers/ 
controller.rb:72:in `start' 
     from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/lib/thin/runner.rb:20 
0:in `run_command' 
     from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/lib/thin/runner.rb:15 
6:in `run!' 
     from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/bin/thin:6:in `<top (
required)>' 
     from C:/Ruby21/bin/thin:23:in `load' 
     from C:/Ruby21/bin/thin:23:in `<main>' 

我使用的是PG 0.18.4,這似乎是最新版本:

D:\dev\derek\50web\servers\dev>gem list pg 

*** LOCAL GEMS *** 

pg (0.18.4) 

D:\dev\derek\50web\servers\dev>gem update pg 
Updating installed gems 
Nothing to update 

的Ruby版本是2.1.7p400 (2015-08-18 revision 51632) [i386-mingw32]

我該如何解決這個錯誤?

更新1(2016年2月2日08:08 MSK):

我已經運行在不同的機器上的同一個項目:

C:\usr\dp\dev\derek\50web\servers\dev>ruby lat.ru 
C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- 2.2/pg_ext (LoadError) 
     from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' 
     from C:/Ruby22/lib/ruby/gems/2.2.0/gems/pg-0.18.4/lib/pg.rb:14:in `rescue in <top (required)>' 
     from C:/Ruby22/lib/ruby/gems/2.2.0/gems/pg-0.18.4/lib/pg.rb:3:in `<top (required)>' 
     from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require' 

我注意到,紅寶石似乎已認準了2.2/pg_ext目錄中的pg_ext文件,而實際上它安裝在C:\Ruby22\lib\ruby\gems\2.2.0\gems\pg-0.18.4\lib目錄中。

Location of pg_ext file

回答

0

我通過卸載pg gem並使用gem install pg --pre命令重新安裝它來修復了錯誤。這是必要的,因爲bug尚未在發行版本中修復。

0

它看起來像安裝pg寶石的C-延伸部分被打破。

  • 確保PostgreSQL的開發庫安裝
  • 重裝pg寶石,看看有沒有錯誤消息

-f強制標誌,或者更好gem uninstallgem install重新重新安裝。

+0

如何安裝「postgresql開發庫」? AFAIR我試過'gem install pg-devel',但它說沒有這樣的寶石。 –

+0

@DmitriPisarenko在安裝gem之前,需要在編譯搜索路徑中有postgresql庫和頭文件,否則gem build將會失敗。如果您在Windows上,請從官方PostgreSQL頁面上的可用二進制文件[鏈接](http://www.postgresql.org/download/windows/)進行安裝。剛剛檢查過存檔,它包含所需的開發文件。 – xblake

+0

我怎樣才能知道開發庫是否安裝?哪些文件將出現在哪些目錄中? –