如何用sudo gem安装rails?

时间:2017-05-12 05:38:17

标签: ruby rubygems

$ gem install rails
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /home/user/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0 directory.
$ sudo gem install rails
sudo: gem: command not found
$ gem -v
2.6.12

为什么sudo gem install rails导致命令未找到?
现在如何安装rails?

user@debian:~$ su root
Password: 
root@debian:/home/user# gem install rails
bash: gem: command not found

1 个答案:

答案 0 :(得分:0)

您可以使用root用户

su root
gem install rails