您对/var/lib/gems/2.3.0目录没有写入权限 [英] You don't have write permissions for the /var/lib/gems/2.3.0 directory
问题描述
$ which ruby
/ usr / bin / ruby
$ ruby -v
ruby 2.3.0p0(2015-12-25)[x86_64-linux-gnu]
$ gem install bundler
错误:执行gem时(Gem :: FilePermissionError)
您没有写入/var/lib/gems/2.3.0目录的权限。
任何帮助都将不胜感激!
首先需要用类似于的方式卸载由Ubuntu安装的ruby,sudo apt-get remove ruby
。
然后使用 rbenv 和 ruby-build 根据他们的文档:
< coded> cd $ HOME $ b $ sudo apt-get update $ b $ 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
git clone https://github.com/rbenv/rbenv.git〜/ .rbenv
echo 'export PATH =$ HOME / .rbenv / bin:$ PATH'>> 〜/ .bashrc
echo'eval$(rbenv init - )'>> 〜/ .bashrc
exec $ SHELL
git clone https://github.com/rbenv/ruby-build.git〜/ .rbenv / plugins / ruby-build
echo'export PATH =$ HOME / .rbenv / plugins / ruby-build / bin:$ PATH'>> 〜/ .bashrc
exec $ SHELL
rbenv install 2.3.1
rbenv global 2.3.1
ruby -v
最后一步是安装Bundler: > gem install bundler
rbenv rehash
然后享受! I have ruby installed on my ubuntu 16.04. Any help will be greatly appreciated! You first need to uninstall the ruby installed by Ubuntu with something like Then reinstall ruby using rbenv and ruby-build according to their docs: The last step is to install Bundler: Then enjoy! Derek 这篇关于您对/var/lib/gems/2.3.0目录没有写入权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
$which ruby
/usr/bin/ruby
$ruby -v
ruby 2.3.0p0 (2015-12-25) [x86_64-linux-gnu]
$gem install bundler
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.3.0 directory.
sudo apt-get remove ruby
.cd $HOME
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
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
rbenv install 2.3.1
rbenv global 2.3.1
ruby -v
gem install bundler
rbenv rehash