You are not logged in.

#1 2016-10-14 13:54:23

ywainberg
Member
Registered: 2016-10-14
Posts: 3

chef gem path

Hi

i am trying to install gems for chefdk and i get an error (for example knife-azure gem)

You don't have /root/.chefdk/gem/ruby/2.3.0/bin in your PATH,
      gem executables will not run.
Successfully installed knife-azure-1.6.0


i used sudo to install the gem but it then goes as the output indicated to check a path in root user

how should i edit the ~/.bashrc file to make it work?

Thanks

Offline

#2 2016-10-15 11:01:12

jaergenoth
Member
Registered: 2015-01-16
Posts: 85

Re: chef gem path

Edit: Disregard what I wrote here and do what cirrus told below.

I have never used Ruby or installed gems, but I don't think you should install them with sudo.
As the error indicates the gems are installed in the root users home directory.

As to what you should do; stop installing gems with sudo and put something like this in ~/.bashrc or ~/.bash_profile:

export PATH="${PATH}:/home/username/.chefdk/gem/ruby/2.3.0/bin"

Last edited by jaergenoth (2016-10-15 17:42:15)

Offline

#3 2016-10-15 16:54:22

cirrus
Member
From: Glasgow Scotland
Registered: 2012-08-24
Posts: 340
Website

Re: chef gem path

Put these in your ~/.gemrc to ensure all gems will be installed as user

gem: --user-install
gem: --no-ri --no-rdoc --no-document --suggestions
gempath: /home/$USER/.gem/ruby/2.3.0/bin

or install gems with ..

gem install --user-install <rubygem name> 

otherwise you will need elevated priviledges to install and run rubygems, as you discovered. Installing systemwide is generally not required.

Last edited by cirrus (2016-10-15 17:00:46)

Offline

#4 2016-10-21 16:17:30

ywainberg
Member
Registered: 2016-10-14
Posts: 3

Re: chef gem path

Hi

thanks for your help and sorry for the late response

your suggestion did not helped eventually...

i managed to fix the issue after updating chefdk to the latest version

Offline

Board footer

Powered by FluxBB