rvm / ubuntu_rvm

Ubuntu package for RVM
https://launchpad.net/~rael-gc/+archive/ubuntu/rvm
Apache License 2.0
694 stars 84 forks source link

Warning! PATH is not properly set up #46

Closed knzudgt closed 4 years ago

knzudgt commented 4 years ago

Description

I installed rvm an year ago following instructions at https://github.com/rvm/ubuntu_rvm. After the update of the last week, when I run rvm list, I receive the following warning message:

$ rvm list
Warning! PATH is not properly set up, /home/marco/.rvm/gems/ruby-2.5.1/bin is not at first place.
     Usually this is caused by shell initialization files. Search for PATH=... entries.
     You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
     To fix it temporarily in this shell session run: rvm use ruby-2.5.1
     To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.

My PATH environment variable is:

$ echo $PATH
/home/marco/bin:/home/marco/anaconda3/bin:/home/marco/bin:/home/marco/.rvm/gems/ruby-2.5.1/bin:/home/marco/.rvm/gems/ruby-2.5.1@global/bin:/usr/share/rvm/rubies/ruby-2.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/share/rvm/bin

I attached below my shell initialization files, ~/.bashrc and ~/.profile How can I solve once for all this issue, making sure to prepend all rvm paths to the $PATH variable?

Environment info

bashrc.txt profile.txt

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
raelgc commented 4 years ago

Hi @knzudgt and thanks for reporting this issue.

Can you, please, try the following solution?

On your .profile, remove these lines:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

Save and close.

Now edit your .bashrc and add this at the bottom:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$PATH:$HOME/bin"
fi

Logout and login again.

knzudgt commented 4 years ago

@raelgc I made the changes you suggested but I am still receiving the same warning. Now my $PATH environment variable is:

$ echo $PATH
/home/marco/anaconda3/bin:/home/marco/bin:/home/marco/.rvm/gems/ruby-2.5.1/bin:/home/marco/.rvm/gems/ruby-2.5.1@global/bin:/usr/share/rvm/rubies/ruby-2.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/share/rvm/bin:/home/marco/bin

As you can see we eliminated the first, duplicate /home/marco/bin from $PATH. Still there are /home/marco/anaconda3/bin and the second /home/marco/bin before /home/marco/.rvm/gems/ruby-2.5.1/bin.

raelgc commented 4 years ago

Right. Thanks for the feedback.

Can you, please, add this to the bottom of .bashrc (yes, at bottom again, after the edit we've added previously):

export PATH="$GEM_HOME/bin:$PATH"
knzudgt commented 4 years ago

@raelgc : done. Now $PATH is as follows:

$ echo $PATH
/home/marco/.rvm/gems/ruby-2.5.1/bin:/home/marco/anaconda3/bin:/home/marco/bin:/home/marco/.rvm/gems/ruby-2.5.1/bin:/home/marco/.rvm/gems/ruby-2.5.1@global/bin:/usr/share/rvm/rubies/ruby-2.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/share/rvm/bin:/home/marco/bin

and the warning message is gone. Thanks!

raelgc commented 4 years ago

Good, I'm glad it solve your issue!

Thanks for your feedback again: it's important to help other users in the future.

raelgc commented 4 years ago

I noticed this is usually an issue while opening new tabs on gnome terminal. Probably a better fix is just append a cd . to ~/.bashrc.

mltsy commented 3 years ago

I'm having this same problem, and trying to solve it the way that makes the most sense - what I don't understand is: why is none of this in the installation instructions? My guess is that it's because it only happens in certain non-standard terminal cases... in my case it's in a VSCode terminal. Running a normal terminal, and changing to the project dir, it seems to work fine. Also changing to the project dir even in VSCode terminal works fine too.

Realizing that just now, I just added cd . to the end of ~/.profile and now it works!

(I already had it in ~/.bashrc as suggested above, but that didn't seem to do the trick - perhaps .profile is what you meant?)

In any case, it might be worthwhile to add this to the installation or troubleshooting instructions??