rails -v
/usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tmpdir.rb:85:in `mkdir': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
Permission denied - ./.gem.20150402-853-1qotwlg
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p451/gems/json-1.8.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.0.0-p451/extensions/x86_64-darwin-13/2.0.0/json-1.8.2/gem_make.out
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tmpdir.rb:85:in `block in mktmpdir'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tmpdir.rb:142:in `create'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tmpdir.rb:85:in `mktmpdir'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/ext/ext_conf_builder.rb:14:in `build'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:160:in `chdir'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:160:in `block in build_extension'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:159:in `synchronize'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:159:in `build_extension'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:195:in `each'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:195:in `build_extensions'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1436:in `block in build_extensions'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/user_interaction.rb:45:in `use_ui'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1434:in `build_extensions'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/stub_specification.rb:60:in `build_extensions'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:924:in `each'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:924:in `find'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems.rb:185:in `try_activate'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p451@global/gems/rubygems-bundler-1.4.2/lib/rubygems_executable_plugin.rb:4:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p451@global/gems/executable-hooks-1.3.1/lib/executable-hooks/hooks.rb:50:in `call'
from /usr/local/rvm/gems/ruby-2.0.0-p451@global/gems/executable-hooks-1.3.1/lib/executable-hooks/hooks.rb:50:in `block in run'
from /usr/local/rvm/gems/ruby-2.0.0-p451@global/gems/executable-hooks-1.3.1/lib/executable-hooks/hooks.rb:49:in `each'
from /usr/local/rvm/gems/ruby-2.0.0-p451@global/gems/executable-hooks-1.3.1/lib/executable-hooks/hooks.rb:49:in `run'
from /usr/local/rvm/gems/ruby-2.0.0-p451/bin/ruby_executable_hooks:10:in `<main>'
答案 0 :(得分:0)
重新安装Ruby:
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
使用RVM
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
和Rails
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
gem install rails -v 4.2.0
rbenv rehash
测试
rails -v
# Rails 4.2.0