安装JSON - Ruby,开发工具包和PATH变量



我一直在尝试安装JSON和Ruby开发工具包以使Rails在Windows 8中工作,这真的很困难。我相信JSON被安装了,但是安装到错误的目录,这就是为什么Ruby找不到它的原因。我认为问题出在我的PATH变量或我的目录上。

当我运行这个命令时:

gem install json -v '1.8.1'

我收到以下输出:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.
    C:/Ruby200/bin/ruby.exe extconf.rb
creating Makefile
make "DESTDIR="

Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.8.
1 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.8.1/ext/json/ext/ge
nerator/gem_make.out

上面的输出让我相信问题出在我的PATH上,但我不能确定它到底是什么。

我认为这一行是最重要的

Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.8.
    1 for inspection.

这让我相信JSON已经安装了,但没有在正确的目录下。

运行gem install后,我收到了这个消息。

Could not find json-1.8.1 in any of the sources
Run `bundle install` to install missing gems.
Temporarily enhancing PATH to include DevKit...

问题可能与路径有关的另一个线索。如果它暂时增强了路径,那就意味着路径一开始就不对。

这是运行PATH:

的结果
C:Ruby200bin; C:Windowssystem32; C:WindowsSystem32Wbem; 
C:WindowsSystem32WindowsPowerShellv1.0;C:Program FilesHewlett-PackardSimplePass; 
C:Program Files (x86)Windows LiveShared; 
C:Program Files (x86)ATI TechnologiesATI.ACECore-Static;C:Program Filesnodejs;
C:Users********AppDataRoamingnpm – 

这里有更多信息:

* Ruby Version - 2.0.0
* Operating System - Windows 8
* Platform - 64bit
* Devkit version - mingw64-64-4.7.2-20130224-1432-sfx.exe

我还运行了以下命令:

chdir C:Ruby200devkit
ruby dk.rb init
ruby dk.rb review
ruby dk.rb install

这是我的Ruby目录的位置:

C:Ruby200

这是我的devkit在我的Ruby目录中的位置:

C:Ruby200devkit

以下是位于devkit目录下的文件和目录:

etc (directory)
  >fstab.sample
  >inputrc.default
  >profile
  >termcap
mingw (directory)
  >bin (directory)
  >contrib (directory)
  >include (directory)
  >lib (directory)
  >libexec (directory)
  >licenses (directory)
  >man (directory)
  >manifest (directory)
  >share (directory)
  >x86_64_w64-mingw32 (directory)
  >mingw64env.cmd
postinstall (directory)
  >pi.bat
  >pi.sh
sbin (directory)
  >awk (directory)
devkitvars.bat
devkitvars.ps1
dk.rb
m.ico
msys.bat
msys.ico

我不知道我做错了什么,但一如既往,我将非常感谢帮助。

编辑:我已经搜索了Stack Overflow的每一页,仍然找不到答案。

我遵循了

https://github.com/oneclick/rubyinstaller/issues/184

And ran

gem update --system 2.0.3

这样就消除了错误

然而,现在我个人现在得到这个错误当我运行

gem install json

ERROR:  Could not find a valid gem 'json' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - SSL_connect retur
ned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (
https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz)

也许你会有更好的运气。可能是他们的服务器?

这样做:

gem sources -a http://rubygems.org

然后用Y回答,再试一次。

这对我来说很有效。祝你好运

最新更新