'RVM says it is using 2.7.3, but ubuntu says i am on 2.7.0
Using Ubuntu, I ran the command
rvm use 2.7.3
I then ran
sudo rake db:create
and was greeted by the error
Your Ruby version is 2.7.0, but your Gemfile specified 2.7.3
Am I doing something wrong here? I have been battling with this for hours and have no idea how to proceed
Solution 1:[1]
The $PATH variable when using sudo is not the same as the $PATH for your non-sudo user. Because RVM works by modifying $PATH, the RVM modifications are lost when you invoke sudo. That's why RVM stops working with sudo.
If you really need to run something as root using RVM, then you can try it with rvmsudo instead.
You can read more here:
rvmsudo vs sudo?
Also check the manual for rvmsudo:
https://rvm.io/integration/sudo
However in your case it's better to adjust access to the database, so that root privileges are not needed for Rails to connect to the DB.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Casper |
