简体   繁体   English

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

[英]ERROR: Error installing json: ERROR: Failed to build gem native extension

I am trying to install gem json and getting error for json.我正在尝试安装 gem json 并收到 json 错误。

I'm running:我在跑:

  • Windows 8.1 (64 bit) Windows 8.1(64 位)
  • Ruby: ruby 1.9.3p545 (2014-02-24) [i386-mingw32] Ruby:ruby 1.9.3p545(2014-02-24)[i386-mingw32]
  • gem: 1.8.2宝石: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>

Its a late response, but may it helps someone else. 这是一个迟到的反应,但它可能会帮助其他人。 to install json '1.8.3' it requires packages 'libgmp3-dev'. 安装json'1.8.3'它需要包'libgmp3-dev'。

Use following steps: 使用以下步骤:

sudo apt-get install libgmp3-dev

gem install json -v '1.8.3'

To help you here are some steps to follow in order to install your gem locally: 为了帮助您,请在本地安装宝石时遵循以下步骤:

  1. Download json-1.8.3 . 下载json-1.8.3
  2. Place the downloaded gem into a folder called gems 将下载的gem放入名为gems的文件夹中
  3. Open the Ruby cmd console (click on start button, select Ruby then select "Start command prompt with Ruby") 打开Ruby cmd控制台(单击开始按钮,选择Ruby然后选择“使用Ruby启动命令提示符”)
  4. cd to the gems folder. cd到gems文件夹。 If the path to the folder is C:\\Desktop\\gems , write the command: cd C:\\Desktop\\gems then click "Enter". 如果文件夹的路径是C:\\Desktop\\gems ,请编写命令: cd C:\\Desktop\\gems然后单击“Enter”。
  5. To install the gem run the following command: 要安装gem,请运行以下命令:

     gem install --local json-1.8.3.gem 

I tried it and it worked for me, hopefully it will work for you. 我尝试了它,它对我有用,希望它对你有用。

Result: 结果: 在此输入图像描述


Second way: 第二种方式:

Include the whole path of the gem in the command: 在命令中包含gem的整个路径:

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): (这次使用json-1.8.2.gem):

在此输入图像描述

For anyone who has this issue on Sierra, I solved the problem through this thread: https://teamtreehouse.com/community/installing-ruby-on-mac-got-error 对于在Sierra上有这个问题的人,我通过这个帖子解决了这个问题: https//teamtreehouse.com/community/installing-ruby-on-mac-got-error

Coles notes version is that after updating to most recent version of XCode, I had to accept the terms for the XCode command line tools. Coles备注版本是在更新到最新版本的XCode之后,我不得不接受XCode命令行工具的条款。 See them/agree to them by running: 通过运行看到/同意他们:

gcc --version

After I did that, everything installed as expected. 在我这样做之后,所有内容都按预期安装。

I've solved this by installing Command Line Tools Xcode of the version I have.我已经通过安装我拥有的版本的命令行工具 Xcode 解决了这个问题。 I hope this helps someone else.我希望这对其他人有帮助。

If you installed Rails through RailsInstaller, try this - 如果你通过RailsInstaller安装了Rails,试试这个 -

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

It's a pretty common bug for RailsInstaller currently. 这是目前RailsInstaller的常见错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:安装pg时出错:错误:无法构建gem原生扩展 - ERROR: Error installing pg: ERROR: Failed to build gem native extension 错误:安装导轨时出错:错误:无法构建 gem 本机扩展 - ERROR: Error installing rails: ERROR: Failed to build gem native extension 错误:安装 gollum 时出错:错误:无法构建 gem 本机扩展 - ERROR: Error installing gollum: ERROR: Failed to build gem native extension 错误:安装 ffi 时出错:错误:无法构建 gem 本机扩展 - ERROR: Error installing ffi: ERROR: Failed to build gem native extension 错误:安装jekyll时出错:错误:无法构建gem原生扩展 - ERROR: Error installing jekyll: ERROR: Failed to build gem native extension 错误:安装nokogiri时出错:错误:无法构建gem本机扩展 - ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension 错误:安装错误 sass:错误:无法构建 gem 本机扩展 - ERROR: Error installing sass: ERROR: Failed to build gem native extension Gem :: Ext :: BuildError:错误:无法构建gem本机扩展,安装json(1.8.1)时发生错误 - Gem::Ext::BuildError: ERROR: Failed to build gem native extension, An error occurred while installing json (1.8.1) 安装mysql2 gem时出错:无法构建gem原生扩展 - Error installing mysql2 gem: Failed to build gem native extension 错误:安装Sablon gem时无法构建gem本机扩展 - ERROR: Failed to build gem native extension when installing Sablon gem
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM