Permission Denied installing rabl gem - ruby-on-rails

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)/*

Related

An error occurred while installing nio4r (2.3.1) - fresh rails install

I'm installing rails on a new machine (high sierra to be exact) i've gone through the setup rails from go rails, however whenever i go to bundle install this is the following error:
Errno::EACCES: Permission denied # dir_s_mkdir - /Users/jake/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-17/2.5.0-static/nio4r-2.3.1
An error occurred while installing nio4r (2.3.1), and Bundler cannot continue.
Make sure that `gem install nio4r -v '2.3.1'` succeeds before bundling.
I've downloaded command line tools, i've downloaded xcode (the actual app) I also accidentally downloaded postgres (via command line) first, before mysql. I'm unsure whether this has anything to do with it
thanks in advance!
It appears i've installed nio4r-2.3.1 in sudo, and therefore didn't have the correct permissions to access it when not in sudo. i ran the following command to change the directory:
sudo chown -R jake ~/.rbenv
big thanks to The Tin Man for his details post on this: - How to fix a bundle install "nio4r error" on Rails 5.0.0

libxml issue when installing twilio-ruby gem

I've been running in circles trying to install the 'twilio-ruby' gem in my rails app to no avail. Every time I try to bundle install I receive errors around libxml. Below is a part of the error I'm receiving when I add 'twilio-ruby' to the gem-file and try to bundle install:
Errno::EACCES: Permission denied # rb_sysopen - /Users/George/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/libxml-ruby-3.0.0/HISTORY
An error occurred while installing libxml-ruby (3.0.0), and Bundler cannot continue.
Make sure that `gem install libxml-ruby -v '3.0.0'` succeeds before bundling.
Trying to gem install libxml-ruby results in the error below:
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /Users/George/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/libxml-ruby-3.0.0/HISTORY
Any help that points me in the right direction would be much appreciated.
to install correctly rbenv follow the instructions on github for your operating system (Mac or Linux)
rbenv installation
While to better understand this problem, it is connected to security issues. Mac and Linux are Unix based system, where the user logs in and can execute commands on his home directory ~/<user>. If you try to execute a command to run a script in another directory like the root directory / or /bin, you will get an authorization error and you will need to run the command with sudo that stands for system user do.
For this reason, with linux you configure the ~/.bash_profile file
Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility.
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
Ubuntu Desktop note: Modify your ~/.bashrc instead of ~/.bash_profile.
Zsh note: Modify your ~/.zshrc file instead of ~/.bash_profile.
so that those command irb, gem, rake, rails when executed from the user they:
Search your PATH for an executable file named rake
Find the rbenv shim named rake at the beginning of your PATH
Run the shim named rake, which in turn passes the command along to rbenv
explanation of shims in rbenv
You can also solve easily this problem by running the command with sudo, but it is not reccommended, as you can read also from the below post where they have the same problem but with rvm,
Why do I get a "permission denied" error while installing a gem?

How to fix permissions error when installing Rails on Windows

I have Ruby 2.2.6 and Rails 5.0 installed succesfully, however I don't seem to be able to install gems. Here's the error I get:
Errno::EACCES: Permission denied # rb_sysopen -
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/nokogiri-1.7.1-x86- mingw32/lib/nokogiri/2.3/nokogiri.so
An error occurred while installing nokogiri (1.7.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.7.1'` succeeds before bundling.
I searched for solutions but all the suggestions are for Unix commands.
I'm on Windows so I'm not sure how to enable permissions in order for this install to pass succesfully.
Any (ELI5 level) suggestions for me?
Have you tried executing:
gem install nokogiri -v '1.7.1'
In your command line?
If you are still getting an error, post the error message.
If you go to the Nokogiri website, you'll find special instructions for installing it on Windows.
A number of Ruby libraries are called native libraries, meaning they're written in C for Unix, and so require Unix build tools to make.

Gem error to install

I try to install rails but I am faced to the following error.
Has somebody any idea how to resolve it ?
C:\Users\Utilisateur>gem -v
2.0.14
C:\Users\Utilisateur>gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name (htt
ps://rubygems.org/latest_specs.4.8.gz)
C:\Users\Utilisateur>gem install rails --source http://rubygems.org
ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name (htt
ps://rubygems.org/latest_specs.4.8.gz)
Unable to download data from http://rubygems.org/ - no such name (http
://rubygems.org/latest_specs.4.8.gz)
First try to update ruby gems.
gem update --system
The issue most likely is with your internet connection.
If you see this issue again, try
gem install rails --source http://rubygems.org
You can add the not https source permanently like this
gem sources -a http://rubygems.org
Do you want to add this insecure source? [yn]y
I want to give you one more tip:
Don't develop rails on windows. Ruby and rails and many gems are very UNIXy in their ways. Install virtualbox and ubuntu on a virtual machine and run you development for there.
You might have proxy in your system. So use sudo http_proxy=http://host:port gem install rails.
I had the same issue but I ran the "Start command prompt with Ruby" as an administrator and tried the gem install rails and it worked.
I had to run 'gem install' as root to get this to work. I.e. 'sudo', which is less than ideal.
I suspect 'gem' has very poor error reporting and doesn't communicate the real cause from a permissions issue deep down the stack.
In my country for some strange reason rubygems.org domain is blocked. So a vpn was the solution for me.
My problem was I had configured a proxy in my network connection as #theBuzzyCoder said, so I simply changed my connection and it worked, I could install my gem (sass in my case)

Error while bundling Rails application (missing gems?)

Note: this is my first attempt with Ruby and Rails!
Once I've installed everything I tried to create a new app with
rails new rubyapp
the command created everything and then the bundler started. While running it stopped at
Errno::EACCES: Permission denied - /Library/Ruby/Gems/1.8/build_info/coffee-script-source-1.6.2.info
An error occurred while installing coffee-script-source (1.6.2), and Bundler cannot continue.
Make sure that `gem install coffee-script-source -v '1.6.2'` succeeds before bundling.
well.. no problem.. let's install this..
sudo gem install -p http://myproxy:8080 coffee-script-source -v '1.6.2'
Installing ri documentation for coffee-script-source-1.6.2
1 gem installed
Good. Try again.
bundle install
and stopped here:
Errno::EACCES: Permission denied - /Library/Ruby/Gems/1.8/build_info/execjs-1.4.0.info
An error occurred while installing execjs (1.4.0), and Bundler cannot continue.
Make sure that `gem install execjs -v '1.4.0'` succeeds before bundling.
!!!
Needless to say that I've installed this, tried again and the same error came up with different "gems".
My question is: is there a command to find if I've everything I need installed without doing these steps tons of times (also because they're pretty slow..)?
I've also tried bundling with sudo but maybe it's not working for the proxy.. : /
Thanks in advance
Just to help anyone still looking (I presume you fixed it in the end) running the command sudo chown myuser:myuser /Library/Ruby/Gems/1.8/build_info/ (where /Library/Ruby/Gems/1.8/build_info/ is the directory referenced in the error) fixed this.
I encourage you to install RVM (or rbenv) to install/uninstall ruby interpreters. Ruby interpreter bundled with Mac OS X is too old. Also gem installation procedure for system ruby interpreter requires superuser privileges.
If it is your first attempt to Rails world, please, start it with right tools, and actual ruby version (1.9.3).
Here you can find how to install RVM: https://rvm.io/rvm/install/
Good luck!

Resources