0
$ 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

Why sudo gem install rails result in command not found?
How to install rails now?

user@debian:~$ su root
Password: 
root@debian:/home/user# gem install rails
bash: gem: command not found
  • refer to this post http://stackoverflow.com/q/24706277/6521116 and answer http://stackoverflow.com/a/24757932/6521116 to check it. – LF00 May 12 '17 at 05:44
  • check who is the current user using `whoami` and then do `ll /home/user/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0` and check who is the owner – Siva Praveen May 12 '17 at 07:38

1 Answers1

0

You can use the root user,

su root
gem install rails
LF00
  • 27,015
  • 29
  • 156
  • 295