捆绑安装上的json gem install错误

时间:2012-09-05 19:54:06

标签: ruby ruby-on-rails-3 json ruby-on-rails-3.2

当我尝试进行捆绑安装时,我收到以下json错误。捆绑安装未完成。是什么给了什么?

Errno::EACCES: Permission denied - /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/json-1.7.5/.gitignore
An error occurred while installing json (1.7.5), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.5'` succeeds before bundling.

>>$ gem install json -v '1.7.5'
ERROR:  While executing gem ... (Errno::EACCES)
Permission denied - /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/json-1.7.5/.gitignore

编辑:sudo install命令出现以下错误:

>>$ sudo gem install json -v '1.7.5' 
Building native extensions.  This could take a while...
ERROR:  Error installing json:
ERROR: Failed to build gem native extension.

    /usr/local/Cellar/ruby/1.9.3-p194/bin/ruby extconf.rb
creating Makefile

make
sh: make: command not found


Gem files will remain installed in /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/json-1.7.5 for inspection.
Results logged to /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/json-1.7.5/ext/json/ext/generator/gem_make.out

2 个答案:

答案 0 :(得分:4)

你需要安装ruby1.8-dev而不仅仅是ruby1.8,你缺少开发标题。

如果在OSX上:

sudo install ruby1.8-dev

如果在unix上

sudo aptitude install ruby1.8-dev

sudo apt-get install ruby1.8-dev

使用rubygems源进入你的目录并运行:    sudo ruby setup.rb 在那之后:

如果在OSX上:

sudo gem install json -v '1.7.5'

某些unix系统可能需要gem version命令才能正常工作,因此您应该运行:

sudo gem1.8 install json -v '1.7.5'

答案 1 :(得分:1)

尝试使用此脚本

  

sudo chown -R $ USER / usr / local