错误:安装json时出错:错误:无法构建gem原生扩展

时间:2015-06-30 12:41:49

标签: ruby json gem

我正在尝试安装gem json并为json获取错误。

我正在跑步:

  • Windows 8.1(64位)
  • Ruby:ruby 1.9.3p545(2014-02-24)[i386-mingw32]
  • gem:1.8.2

D:\GIT\calabash>gem install json -v '1.8.3'
Building native extensions.  This could take a while...
The system cannot find the path specified.
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3/ext/json/ext/generator/gem_make.out

D:\GIT\calabash>

4 个答案:

答案 0 :(得分:3)

它是一个迟到的回应,但它可能会帮助其他人。安装json'1.8.3'它需要包'libgmp3-dev'。

使用以下步骤:

sudo apt-get install libgmp3-dev

gem install json -v '1.8.3'

答案 1 :(得分:1)

To help you here are some steps to follow in order to install your gem locally:

  1. Download json-1.8.3.
  2. Place the downloaded gem into a folder called gems
  3. Open the Ruby cmd console (click on start button, select Ruby then select "Start command prompt with Ruby")
  4. cd to the gems folder. If the path to the folder is C:\Desktop\gems, write the command: cd C:\Desktop\gems then click "Enter".
  5. To install the gem run the following command:

    gem install --local json-1.8.3.gem
    

I tried it and it worked for me, hopefully it will work for you.

Result: enter image description here


Second way:

Include the whole path of the gem in the command:

gem install --local C:\Users\kedarl\Desktop\T\json-1.8.2.gem

For me here is the result. (This time with the json-1.8.2.gem):

enter image description here

答案 2 :(得分:1)

对于在Sierra上遇到此问题的任何人,我通过以下帖子解决了问题:https://teamtreehouse.com/community/installing-ruby-on-mac-got-error

Coles备注版本是在更新到最新版本的XCode之后,我不得不接受XCode命令行工具的条款。通过运行来看他们/同意他们:

gcc --version

在我这样做之后,所有内容都按预期安装。

答案 3 :(得分:-1)

如果你通过RailsInstaller安装了Rails,试试这个 -

https://gist.github.com/luislavena/f064211759ee0f806c88

目前RailsInstaller是一个非常常见的错误。