Question

How to install a gem via user account?

I am logged in as user. I gave all root privileges to user. Now I am doing bundle install. It is breaking by saying "Make sure that gem install nokogiri before bundling. Now when I try to install by gem install nokogiri , it says permission denied. When I try it with sudo gem install nokogiri, then it says “sudo: gem: command not found”. How can I install this gem?

Subscribe
Share

If you have Ruby installed I am not sure why sudo would say that the command was not found. I would recommend checking that Ruby is installed:

sudo apt-get update;
sudo apt-get install ruby

Then try running the gem install using the full path:

sudo /usr/bin/gem install nokogiri

Some gems may require additional libraries in order to build and if you encounter errors you may want to try installing ruby-dev and build-essential to start with.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This question was answered by @anishajayan:

swapon solved this issue. I followed this- “https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04

View the original comment