[英]Cannot install JSON gem in rails using windows
我正在進行捆綁安裝,所有的Gems工作正常,除了JSON,當它到達JSON gem我收到此錯誤。
Installing json (1.6.1) with native extensions c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:55
2:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::E
xtensionBuildError)
c:/Ruby192/bin/ruby.exe extconf.rb
checking for re.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
有什么可能導致這個錯誤的想法嗎?
您正在使用Windows,因此RubyInstaller開發工具包可以幫助您: http ://rubyinstaller.org/add-ons/devkit/
devkit安裝了一個C編譯器(以及其他一些東西)來編譯C編寫的部分。
安裝它並再次嘗試安裝gem - 也許使用選項--platform=ruby
。
有關詳細信息, 請訪問https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
那是因為這個gem使用了一段代碼寫在C上。為了正常工作,你需要在你的機器上安裝c編譯器。 作為一種方式,嘗試使用在純Ruby上編寫的json_pure
我不是ROR的專家,但我在安裝Redmine時遇到的JSON安裝問題通過執行以下操作解決:
我意識到,mingw32-make.exe從未起作用,但'D:\\ LANGS \\ MinGW \\ msys \\ 1.0 \\ bin \\ make.exe'工作。
注意:我的MinGW安裝在D:\\ LANGS \\下。 請在特定安裝中進行相應更改。
是的,安裝開發套件。 此外,您需要運行一些命令行來安裝它(而不僅僅是下載和運行)。
下載它,運行它以將其提取到某個地方(永久)。 然后cd到它,運行ruby dk.rb init和ruby dk.rb install將它綁定到路徑中的ruby安裝。
這方面的指南在這里:
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.