Why do I get write permissions when installing Rails?

When I use rvm use 1.9.2 , I get Rails v3.0.0:

 vikas@admin1-DL-H61MXEL :~$ rvm use 1.9.2 --default Using /home/vikas/.rvm/gems/ruby-1.9.2-p320 vikas@admin1-DL-H61MXEL :~$ rails -v Rails 3.0.0 

When I use rvm use 2.0.0 , I get Rails v3.2.13:

 vikas@admin1-DL-H61MXEL :~$ rvm use 2.0.0 Using /home/vikas/.rvm/gems/ruby-2.0.0-p195 vikas@admin1-DL-H61MXEL :~$ rails -v Rails 3.2.13 

I need Rails v3.2.13 with Ruby 1.9.2.

When I used rvm use 1.9.2 --default and gem install rails -v 3.2.13 , I got the following error:

 While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /home/vikas/.rvm/gems/ruby-1.9.2-p320/bin directory. This is the error I'm facing now. 
+6
source share
3 answers

The most likely reason you get the error:

 (Gem::FilePermissionError) You don't have write permissions into the /home/vikas/.rvm/gems/ruby-1.9.2-p320/bin directory. 

This is because at some point you used sudo or acted as root when using RVM to install the gem. When this happened, the ownership of the files and / or folders changed to root permissions, which you cannot revoke at startup like you do.

You don’t want to run as root or use sudo EVER when you run the rvm or gem commands if you have RVM installed to provide Ruby in the sandbox in your home directory.

To fix this, try the following command:

 sudo chown -R vikas ~/.rvm 

This will use sudo to change ownership of all files in the ~ / .rvm directory to your own account, from the root user. It takes at least a few seconds, so let it start.

Once this starts, you can switch to each of your Rubies and remove the installed Rails:

 rvm use 1.9.2 gem uninstall rails gem install rails -v 3.2.13 

Then:

 rvm use 2.0.0 gem uninstall rails gem install rails -v [whatever version you want] gem install rails -v 
+20
source
 rvm use 1.9.2 --default Using /home/vikas/.rvm/gems/ruby-1.9.2-p320 gem install rails -v 3.2.13 
0
source

rvm is a software tool with which you can manage multiple versions of rubies on your system.

for each version of ruby ​​you can create a gemset, which is just a group of gems.

every ruby ​​version you install has a "default" gemset.

and it seems that you installed rails 3.0 for ruby ​​1.9.2 and rails 3.2.13 for ruby ​​2.0

you can create your own gemset team

 rvm gemset create rails3 

this will create a gemset named "rails3" and to use it you need to do

 rvm gemset use rails3 

and in this gemset you can install any version of rails that you want.

with the team

 gem install rails -v='3.2.13' 

see rvm doc for more information.

https://rvm.io/

0
source

Source: https://habr.com/ru/post/948677/


All Articles