ruby-on-railsrubyrubygemscanvas-lms

Bundle install gives LoadError


I'm trying to install Canvas LMS. As I'm doing the production start for installing bundler and canvas dependencies I first run

sudo gem install bundler --version 2.2.19 --default

which executes successfully. Then I run

bundle _2.2.19_ install --path vendor/bundle

which gives the following error:

Traceback (most recent call last):
    1: from /usr/local/bin/bundle:23:in `<main>'
/usr/local/bin/bundle:23:in `load': cannot load such file -- /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/exe/bundle (LoadError)

Here is what I get when I run gem env:

RubyGems Environment:
  - RUBYGEMS VERSION: 3.1.2
  - RUBY VERSION: 2.7.5 (2021-11-24 patchlevel 203) [x86_64-linux-gnu]
  - INSTALLATION DIRECTORY: /var/lib/gems/2.7.0
  - USER INSTALLATION DIRECTORY: /home/sam/.gem/ruby/2.7.0
  - RUBY EXECUTABLE: /usr/bin/ruby2.7
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /home/sam/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/gems/2.7.0
     - /home/sam/.gem/ruby/2.7.0
     - /usr/lib/ruby/gems/2.7.0
     - /usr/share/rubygems-integration/2.7.0
     - /usr/share/rubygems-integration/all
     - /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/sam/.nvm/versions/node/v16.16.0/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games

And running bundler -v gives me this result: Bundler version 2.3.25

I'd appreciate any help to solve this load error.


Solution

  • Yep. I ran into the exact same issue but was able to fix with the below

    sudo gem install bundler -v '2.2.19'

    then

    bundle _2.2.19_ install --path vendor/bundle

    and was able to complete the installation successfully.

    You may likely get an error at the end

    An error occurred while installing idn-ruby (0.1.4), and Bundler cannot continue. Make sure that gem install idn-ruby -v '0.1.4'--source 'https://rubygems.org/' succeeds before bundling.

    You can fix that by following the steps here

    sudo apt-get install libldap2-dev libidn11-dev