I try to install rails 3.2.20 with ruby2.2.0.
So with rvm I make
rvm install 2.2.0
After I make
gem install rails -v 3.2.20
After rvm use default ruby-2.2.2
But when I try rails -v, I have the error
-bash: /home/xxx/.rvm/gems/ruby-2.2.0/bin/rails: Permission denied
Why? I try also chmod -R 777 on .rvm but nothing change
If I try
which ruby I have
/usr/local/rvm/rubies/ruby-2.2.0/bin/ruby
If I try whch rails I have nothing
check if you are logged in as the correct user
check if the permissions of the user’s home directory are correct, e.g. /home/xxx/
remove the ruby under /usr/local/bin
reinstall rvm if all fails
Related
I installed ruby 2.6.3 using RVM. later when i try to install rails i am getting following error.
$ gem install rails -v 6.0.2.1
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/local/rvm/gems/ruby-2.6.3 directory.
$ sudo gem install rails -v 6.0.2.1
sudo: unable to execute /usr/bin/gem: No such file or directory
That's because at some point you used sudo to install your rvm. So, the system will require sudo permission to install later gems
When you use command $ sudo gem install rails -v 6.0.2.1, you tell system to use normal directly installed ruby, not via rvm, so it warns you No such /user/bin/gem error
The solution for this is to change ownership of all files in the ~/.rvm directory to current account, as if you're using root account by following command
sudo chown -R $USER ~/.rvm
I have had rails installed and almost working. Was working on a solution to another problem with I accidentally closed the bash window. So I reopened it, and now I am unable to use rails at all and it's telling me that rails isn't installed. So I ran gem install rails --no-ri --no-rdocand now I get the following:
ERROR: While executing gem ... (Errno::EEXIST)
File exists # dir_s_mkdir - /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/gems`
How do I correct this error?
I just removed the broken gems, site_ruby and vendor_ruby symlinks from the /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/ folder and now everything seems to work fine.
I just added a gems/ directory here /usr/local/lib/ruby/ and that solved the issue.
for a temporary solution, you can mkdir -p /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/gems/2.1.0 to solve.
When you open your bash window (called the "terminal window" or "console"), what folder ("directory") are you in? Find out with:
$ pwd
Navigate to the folder where you created your Rails project using the Unix cd command, for example:
$ cd workspace/learn-rails
If you are using RVM, make sure you have selected the correct gemset:
$ rvm gemset list
gemsets for ruby-2.1.1 (found in ...)
(default)
global
=> learn-rails
Then see if Ruby and Rails are installed:
$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
$ rails -v
Rails 4.1.0
Refer to the article Install Ruby on Rails for help. If you haven't followed all the steps in the article, you may have problems, especially if you followed some of the inaccurate instructions found elsewhere on the web.
I was recently in this wormhole. It seems like Homebrew's ruby installation has an issue with soft links and uses version 2.1.1. I couldn't "gem install" anything without getting the annoying "File exists # dir_s_mkdir" error. Even tried MacPort and that was a nightmare.
First uninstall ruby via
brew uninstall ruby
or
port uninstall ruby
And follow the instruction on https://rvm.io/rvm/install to install ruby
\curl -sSL https://get.rvm.io | bash -s stable --ruby
It might then complain about ruby-2.0.0-p353 not installed
To install do:
rvm install ruby-2.0.0-p353
Then run the rvm install script. Your "gem install << whatever >>" should now work
This fixed the issue for me (Homebrew on a Mac, Ruby 2.1.3):
$ brew reinstall ruby
$ brew unlink ruby && brew link ruby
the same issue. I just remove dir_s_mkdir, then pod install. it works for me!
After upgrading to Rails 4.0.4 and Ruby 2.1.1, i have permission problems with rbenv rehash. I tried bundler install to 1.5.3. Ok. But still no. bashrc (Ubuntu 13.04) is fine, that is, as before. ruby -v shows the proper versions of global and local Ruby, as does rails -v. Only 'rehash' seems to be the problem.
.rbenv/plugins/bundler/etc/rbenv.d/bundler/rehash.rb:187:in `initialize': Permission denied # rb_sysopen
Try running the server as a root.
sudo -s
rails s
Change the owner of the dependency files:
sudo chown -R USERNAME /.rvm/
And then change owner of the project file:
sudo chown -R USERNAME /var/www/PROJECTFILE
First I installed rvm for multi-user using script
\curl -L https://get.rvm.io | sudo bash -s stable
and I added users to rvm group.
and rvm seems worked fine. so I installed ruby 1.9.3 and set 1.9.3 as default
and now I tried to install rails with command
gem install rails
It seems worked fine, but when fetching json-1.7.6.gem and an error occurs.
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p374/bin/ruby extconf.rb
creating Makefile
make
sh: make: Permission denied
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p374/gems/json-1.7.6 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p374/gems/json-1.7.6/ext/json/ext/generator/gem_make.out
So I thought it would be related with permission, so I tried
sudo gem install rails
but then this error occurs.
sudo: gem: command not found
What should I do?
use sudo as follows..
sudo gem install rails
Updated Answer:
our $PATH variable needs to include the exact path to your Ruby's bin directory. Adding a directory to the PATH does not include it's subfolders. Try adding the bin directory via:
export PATH=$PATH:/home/adam/.gem/ruby/1.8/bin
or if you installed the gem using sudo:
export PATH=$PATH:/usr/lib/ruby/gems/1.8/bin
You might want to add this to your .bashrc file, so that you don't have to set this manually every time your open up a new bash.
you can use rvmsudo to run sudo commands. But you should really be using Gemfiles to install gems using Bundler.
Installing RVM on Ubuntu 11.04.
Followed the instructions here: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you
When it comes time to install Ruby, I get a permission denied exception.
kevinwmerritt#ubuntu:~$ rvm install 1.8.7
bash: /home/kevinwmerritt/.rvm/scripts/manage: Permission denied
The .rvm folder appears in my home directory and the bash scripts initialize rvm successfully.
Using sudo yields the following:
sudo rvm install 1.8.7
sudo: rvm: command not found
I am new to Ubuntu.
If you did a single-user install of RVM do not use:
sudo rvm install 1.8.7
RVM creates its own sandbox in ~/.rvm which does not need root privileges ever. At NO time do you need to use sudo before rvm. sudo will only screw up everything.
Use an unadorned rvm install 1.8.7 or rvm install 1.9.2 or any other version of Ruby known to RVM. You can see the list it knows about using rvm list.
I am running into the same exact problem. I compared it against another installation of rvm on a different box that is working and noticed the permission for "manage" is different.
The box that is working:
-rwxr-xr-x 1 deployer deployer 59002 2011-05-19 22:56 manage
The box that is not working:
-rw-r--r-- 1 deployer deployer 59076 2011-05-22 22:12 manage
I did a chmod 755 manage and that seems to have fixed it. I installed rvm the same way on both boxes, not sure why there's a difference.
You can try
chmod 755 /home/kevinwmerritt/.rvm/scripts/manage and see if that resolves it