-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Content pulled from this thread
rubygems/rubygems#6092
I think the following is the explanation of what's going on:
TL;DR
That wiki page tutorial is wrong, please submit an issue to Canvas-LMS so that they fix their "Quick Start" instructions. I think the long explanation below should be useful for Canvas-LMS maintainers to fix their instructions.
Long explanation
I don't see any codespace configuration in that repository. When there's no codespace configuration, GitHub will use a "universal image", which is defined here. That image includes Ruby as a feature here. That's the install script I linked to before. This means a default codespace includes Ruby 3.1 (and Ruby 3.0 additionally), both installed and managed by RVM.
Quick start instructions start by installing a OS-packaged Ruby (
apt-get install ruby
), which is Ruby 2.7. This should take no effect since RVM is configured, which takes priority. However, then there are several instructions recommending differentsudo gem install
commands. These are all wrong and unnecessary. There are several reasons for this which explain the error reported here:
sudo
does not preserve the originalPATH
when invoked, so the binstubs installed by those commands will have a shebang pointing to the OS-packaged ruby (because RVM is no longer in PATH), and that will cause the OS packaged Ruby to be run when those binstubs are executed. In particular, because of this, thebundle _2.2.33_ install
command will run under Ruby 2.7, but with environment configured for Ruby 3.1. This explains the mix and match between Ruby versions in the backtrace of the error.- Those
sudo gem install
not only install wrong binstubs, but also corrupt permissions of RVM managed folders, because they will be created with root permissions, and when the low privileges commandbundle _2.2.33_ install
runs, it cannot create any installed files on those folders due to this. This explains theErrno::EACCES: Permission denied @ dir_s_mkdir - /usr/local/rvm/gems/ruby-3.1.3/extensions/x86_64-linux/2.7.0/racc-1.6.0
wording in the error reported.How to get unblocked
There's several things you can try until you get an answer from Canvas-LMS maintainers, such as:
- Completely ignore all
sudo
commands and use preinstalled Ruby and Bundler. So, runbundle install
as soon as the codespace is built.- If Canvas-LMS really needs Ruby 2.7, then use RVM to install and use that Ruby. Head over to https://github.com/rvm/rvm for instructions on how to do this. And again, don't install OS-packaged Ruby through
apt
get and don't run anygem install
commands withsudo
.I hope you found this useful and can get rid of this problem and focus on what you were tying to do. Good luck!