I am running the command
bundle install
in a project folder. In some project folders it will produce an error and in other projects folders it will not produce an error. The error is:
Your user account isn't allowed to install to the system RubyGems
I know this can be fixed by following the recommended advice:
bundle install --path vendor/bundle
My question is why is the behavior inconsistent?
Open up the 'Software Center' app from your launcher and type in `RubyGems` without quotes into the application search box at the top right, and press [enter]. RubyGems then can be installed by just clicking on the button labeled 'Install', thats it.
When you use the --user-install option, RubyGems will install the gems to a directory inside your home directory, something like ~/. gem/ruby/1.9. 1 . The commands provided by the gems you installed will end up in ~/.
In my case, I solved doing just what the error message suggests:
Your user account isn't allowed to install to the system RubyGems. You can cancel this installation and run: bundle install --path vendor/bundle to install the gems into ./vendor/bundle/
So, instead of:
bundle install
I ran:
bundle install --path vendor/bundle
That was the solution for this guy.
The downside of that solution is that it creates a vendor
folder inside the current folder, which can be added to .gitignore
if it is to distribute the application through Git.
Usually if you're using RVM, rbenv or chruby to install Ruby, all the gems will be installed in your home folder under ~/.rbenv/ruby-version/...
If you're using your system Ruby though (the one that is installed by default) the gems are installed alongside it in a location that you don't have access to without sudo
.
My guess would be that your version manager defaults to the system Ruby but some of your projects have a .ruby-version file in them that tells it to use a different version of Ruby which you have access to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With