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
4

3 回答 3

4

您需要安装 ruby​​1.8-dev 而不仅仅是 ruby​​1.8,您缺少开发标头。

如果在 OSX 上:

sudo install ruby1.8-dev

如果在 Unix 上

sudo aptitude install ruby1.8-dev

或者

sudo apt-get install ruby1.8-dev

使用 ruby​​gems 源代码进入您的目录并运行: 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'
于 2012-12-24T20:55:39.613 回答
1

在此处找到答案:在将 redcarpet gem 添加到 Rails 应用程序后运行“$ bundle”时“sh: make: command not found”安装 Mountain Lion 后需要升级命令行工具

于 2012-09-10T20:32:11.907 回答
1

尝试使用此脚本

sudo chown -R $USER /usr/local

于 2012-09-05T20:01:21.620 回答