I'm trying to set up my VPS to deploy my Rails app, and I constantly face these permission denied errors. I think the main problem is that I'm running as "deployer," who's in an admin group, and somehow "deployer" is not getting its rights properly. But this guess could be wrong.
deployer#max:~$ gem install bundler --no-ri --no-rdoc
Fetching: bundler-1.2.3.gem (100%)
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /var/lib/gems
You need to prefix the gem command with sudo because /var/lib/gems is owned by root. You could also take a look at RVM which allows really easy installation and management of gems and Ruby versions.
Just used "sudo" command to solve this issue...
Related
I am trying to install the spree gem but i am having a little trouble installing the gem. currently i am getting an error when trying to install the rabl(0.13.1) gem. I am getting a permission is denied . Wondering how i can fix this error so i can get back to finish installing spree.
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_file_s_symlink
Installing rabl 0.13.1
Errno::EACCES: Permission denied # rb_file_s_symlink -
(fixtures/ashared/views_rails_3/users/phone_number.json.rabl,
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rabl-0.13.1/fixtures/ashared/views_rails_3/users/phone_number.xml.rabl)
An error occurred while installing rabl (0.13.1), and Bundler cannot continue.
Make sure that `gem install rabl -v '0.13.1'` succeeds before bundling.
In Gemfile:
spree was resolved to 3.4.1, which depends on
spree_backend was resolved to 3.4.1, which depends on
spree_api was resolved to 3.4.1, which depends on
rabl
C:\Users\Michael\Desktop\ruby\pen>gem install rabl -v '0.13.1
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_file_s_symlink - (fixtures/ashared/views_rails_3/users/phone_number.json.rabl, C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rabl-0.13.1/fixtures/ashared/views_rails_3/users/phone_number.xml.rabl)
C:\Users\Michael\Desktop\ruby\pen>gem install
ERROR: While executing gem ... (Gem::CommandLineError)
Please specify at least one gem name (e.g. gem build GEMNAME)
C:\Users\Michael\Desktop\ruby\pen>uby/gems/2.4
'uby' is not recognized as an internal or external command,
operable program or batch file.
You can fix it by running your terminal on windows ( "Start Command Prompt with Ruby", "Git Bash" or similar ) as administrator.
If anyone runs into this problem in a Windows environment (windows 10),
use start command prompt with ruby as administrator
and run bundle update
First of all, I would recommend you to use bundler for automatic dependencies resolving.
Regarding your problem, I believe the root cause is here: Permission denied # rb_file_s_symlink - (fixtures/ashared/views_rails_3/users/phone_number.json.rabl
You should check permissions for this file and probably fix them. Because your current user does not have enough rights to access it.
And the last, but not the least, try switching to linux/mac. Windows is really not suitable for productive Ruby developemnt.
Just had this problem when trying to install the Spree gem on ruby on rails.
This was done on Rails 5.1.4, running Ruby ruby 2.3.3p222
This error occurs when you don't have admin rights.
Firstly, locate cmd and then right click on it and click on 'Run as administrator'.
Log in with the appropiate credentials and then when the cmd pops up, run the command again
gem install rabl -v '0.13.1'
And it should be successful!
In mac, I am facing similar issue and fixed by answer here: https://nanxiao.me/en/fix-permission-denied-rb_file_s_symlink-error-of-installing-homebrew/
I have pasted the command in case the link stops working.
sudo chown -R $(whoami) $(brew --prefix)/*
I am trying to deploy an application via Github pages, and based on this tutorial that I am watching, I need to install bundler first.
When I type in the command gem install bundler, I get the error:
While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
I do not have rbenv downloaded and I don't know how to. I also do not fully understand the concept of gems.
How can I bypass this issue?
Try 'sudo gem install bundler'
I am trying to set up a ruby on rails project in a Ubuntu vagrant, and I'm encountering the following problem:
Running:
gem install rails
Gives me
Fetching: rack-1.6.4.gem (100%)
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /usr/local/rvm/gems/ruby-2.3.0/cache/rack-1.6.4.gem
Ok so it's a permissions issue.
As suggested on some other similar topics I ran
sudo chmod -R 1777 tmp/
But this doesn't seem to help me, I'm just getting the same message again.
I know this question has been asked before, but the fixes don't work for me.
I am trying to install rails , in order to install cocoapods but I am having some trouble with permissions.
I tried $ $sudo chown -R username /usr/ but operation is now allowed.
Username-MacBook-Pro:~ username$ $sudo gem install rails
Building native extensions. This could take a while...
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # dir_s_mkdir - /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14
Username-MacBook-Pro:~ username$
You should not install rails with the sudo command for two reasons:
I made this mistake in the past and then I had issues when installing and using other gems because of inconsistencies with permissions. It might very likely cause you the same trouble.
The concern of whether or not to install rails with the sudo command is addressed and well explained in a different post: 'sudo gem install' or 'gem install' and gem locations
The reason why installing gems with sudo is worse than just gem install is because it installs the gems for ALL USERS as root. This might be fine if you're the only person using the machine, but if you're not it can cause weirdness.
I recommend that you install rvm first and then rails. Here is a great tutorial that walks you through the process: http://railsapps.github.io/installrubyonrails-mac.html
I am new to programming and am trying to get rails installed on my terminal. I have been following instructions from a friend, installing the xcode command line tools, homebrew, git, rbenv, ruby-build, ruby gems, ruby, and postgres. But whenever, I try $gem install rails, I get the following:
Russell-Silvers-MacBook-Pro:~ Russell_Silver$ gem install rails
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /Users/Russell_Silver/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rails-4.2.0/README.md
This is especially frustrating because when I run $gem list, it says I have rails 3.2.18. Which is peculiar, because when I run $rails v$, it tells me I have Rails 4.2.0.
When I try to use rails rails my new_app
Errno::EACCES: Permission denied # rb_sysopen - /Users/Russell_Silver/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rails-4.2.0/README.md
An error occurred while installing rails (4.2.0), and Bundler cannot continue.
Make sure that `gem install rails -v '4.2.0'` succeeds before bundling.
run bundle exec spring binstub --all
/Users/Russell_Silver/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.8.3/lib/bundler/shared_helpers.rb:83: warning: Insecure world writable dir /Users/Russell_Silver in PATH, mode 040707
bundler: command not found: spring
Install missing gem executables with `bundle install`
Russell-Silvers-MacBook-Pro:~ Russell_Silver$ bundle install
/Users/Russell_Silver/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.8.3/lib/bundler/vendor/thor/shell/basic.rb:355: warning: Insecure world writable dir /Users/Russell_Silver in PATH, mode 040707
Could not locate Gemfile or .bundle/ directory
This is really frustrating, especially for someone new to programming such as myself, so I am seeking help from anybody who might know what is wrong.
Your rbenv installation was incorrectly installed as it had elevated privileges which caused your user account to not have write access to ~/.rbenv.
Issue the following command in order to take of ownership of the directory:
sudo chown -R Russell_Silver ~/.rbenv
Note that some users may have a different rbenv directory, e.g. /usr/local/var/rbenv. This would take the place of ~/.rbenv in the above command.