After installing rubygems, I tried to install rails.
I entered the following command:
~$ gem install rails
and I got the following error:
Fetching: i18n-0.6.1.gem (100%)
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /var/lib/gems
try using sudo instead.
sudo gem install rails
Related
I have installed postgresql, libpq-dev and build-essential. When I ran gem install pg, I got a
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
I tried every solution I found in stackoverflow, but none of them worked. However, now I ran gem install pg, I got a new error
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /home/woyuxuxu123/.rvm/gems/ruby-2.3.3/gems/pg-0.21.0/.gemtest
Could anyone help me on this? I have been stuck on this for a whole afternoon.
Use sudo before installing the gem or update in your system as like this:
sudo apt update
gem install pg
I'm trying to do a gem update in my terminal, but getting an error:
Updating installed gems
Updating actionpack
Fetching: activesupport-5.0.0.gem (100%)
Successfully installed activesupport-5.0.0
Fetching: rack-2.0.1.gem (100%)
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /Users/MacBook/.rvm/gems/ruby-2.3.1#global/wrappers/rackup
Can someone help why i'm getting this?
If anyone is wondering, I guess I just needed to give permission, and in order to do that just add sudo command in the front, ie:
$ sudo gem update
I have been trying to install pg gem using, gem install pg, and its showing me an error.
Then I tried brew install postgresql, which, in the end showed error stating use/local/bin already exixts. If I am directly running bundle install in the app folder, its showing the error on installing pg 0.18.4, stating permission denied # rb_sysopen.
The errors that I am getting:
Amans-MacBook-Air:~ aman$ gem install pg
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /Users/aman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/pg-0.18.4/.gemtest
Amans-MacBook-Air:~ aman$ brew install postgresql
Warning: postgresql-9.5.3 already installed, it's just not linked
Amans-MacBook-Air:~ aman$ brew link postgresql
Linking /usr/local/Cellar/postgresql/9.5.3... Error: File exists - /usr/local/lib
What should I do, any suggestions!
I'm trying to install the Spree gem, but it's giving me this error:
gem install spree
Fetching: httparty-0.13.3.gem (100%)
When you HTTParty, you must party hard!
Successfully installed httparty-0.13.3
Fetching: highline-1.6.21.gem (100%)
Successfully installed highline-1.6.21
Fetching: friendly_id-5.0.4.gem (100%)
Successfully installed friendly_id-5.0.4
Fetching: font-awesome-rails-4.2.0.0.gem (100%)
Successfully installed font-awesome-rails-4.2.0.0
Fetching: ffaker-1.25.0.gem (100%)
Successfully installed ffaker-1.25.0
Fetching: polyglot-0.3.5.gem (100%)
Successfully installed polyglot-0.3.5
Fetching: colorize-0.7.3.gem (100%)
Successfully installed colorize-0.7.3
ERROR: Error installing spree:
invalid gem: package is corrupt, exception while verifying: undefined method `size' for nil:NilClass (NoMethodError) in /home/tarek/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/cache/nokogiri-1.6.4.1.gem
I tried to uninstall and reinstall Nokogir again, with the same result.
When I tried sudo gem install nokogiri another error happened:
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:4:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.6.4.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.6.4.1/ext/nokogiri/gem_make.out
I think RubyGems didn't download the file properly. So, the system is reporting that the gem is corrupt.
Delete /home/tarek/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/cache/nokogiri-1.6.4.1.gem and then install the gem again.
$ sudo rm /home/tarek/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/cache/nokogiri-1.6.4.1.gem
$ gem install nokogiri
Please make sure you install the following command:
sudo apt-get install libxslt-dev libxml2-dev
Now try installing Nokogiri. Be aware of sudo if you using RVM.
sudo gem install nokogiri
Hope my answer would be helpful.
Thanks.
Looks like you have the system Ruby installed.
You need to first do:
$ sudo apt-get install ruby-dev
and then do:
$ sudo gem install nokogiri
I'd encourage you to use Ruby Version Manager like RVM or rbenv for managing Ruby environments instead of using the system Ruby on your development environment.
I'm trying to install Ruby on rails, so first I installed RVM rvm install 1.9.2. After that install this gem install rails. It shows this error
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /var/lib/gems/1.8 directory.
Then I used this sudo chmod 0777 /var/lib/gems/1.8/
After that when I install, its showing this error:
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /var/lib/gems/1.8/cache/railties-3.2.2.gem
Then I run sudo chmod 0777 /var/lib/gems/1.8/cache/railties-3.2.2.gem
After that I install gem install rails. Again its showing this error
ERROR: While executing gem ... (Errno::EISDIR)
Is a directory - /var/lib/gems/1.8/cache/railties-3.2.2.gem
You're still using the system ruby install (1.8). To use the Ruby you've just installed with rvm, do rvm use 1.9.2. Then try gem install rails again. The Rails gem should be installed under your home directory, you shouldn't need root permissions.
To make the rvm Ruby the default, so you always start with it when you open a new terminal, do rvm --default use 1.9.2 (note that's two dashes).
manually install gem-ctags, then retry installing your failing gem
gem install gem-ctags
gem install backports -v '3.3.3'
bundle install