Help with asdf and bundle

This isn’t really a Discourse problem, but I have it only with Discourse. I’ve done some other searching to no avail, so I’m here now.

If I run bundle install in a freshly cloned discourse directory, I get this:

(main) pfaffman@noreno:~/discourse$ bundle install
/home/pfaffman/.asdf/installs/ruby/3.2.2/bin/bundle:25:in `load': cannot load such file -- /home/pfaffman/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/exe/bundle (LoadError)

If I run it in a directory that has a plugin in it, it works just fine. A while ago, I swear that I cloned discourse and got bundle install to work, but then it stopped.

Here’s how I set things up to try to get stuff to have the right versions of stuff. I think it’s the problem somehow. For some months, or a year, maybe, this worked to get the proper versions of stuff from the latest docker image.

  DISCOURSE_SRC=/home/pfaffman/src/discourse-repos/discourse
  DISCOURSE_DOCKER_SRC=/home/pfaffman/src/discourse-repos/discourse_docker
  cd $DISCOURSE_SRC

  git -C $DISCOURSE_DOCKER_SRC pull https://github.com/discourse/discourse_docker
  DISCOURSE_BASE=$(grep -e ^image= $DISCOURSE_DOCKER_SRC/launcher|cut -d'"' -f2)
  cd -

  docker pull $DISCOURSE_BASE
  asdf plugin add nodejs #https://github.com/asdf-vm/asdf-nodejs.git
  asdf plugin add ruby #https://github.com/asdf-vm/asdf-ruby.git
  asdf plugin add imagemagick
  asdf plugin update --all
  RUBY_VERSION=$(grep -e ^RUBY_VERSION $DISCOURSE_DOCKER_SRC/image/base/install-ruby|cut -d'"' -f2)
  echo "GOT RUBY VERSION!! $RUBY_VERSION"
  asdf install ruby $RUBY_VERSION
  asdf global ruby $RUBY_VERSION
  IMAGE_MAGICK_VERSION=$(grep -e ^IMAGE_MAGICK_VERSION ~//src/discourse-repos/discourse_docker/image/base/install-imagemagick|cut -d'"' -f2)
  echo "GOT IMAGE_MAGICK_VERSION: $IMAGE_MAGICK_VERSION"
  asdf install imagemagick $IMAGE_MAGICK_VERSION
  asdf global imagemagick $IMAGE_MAGICK_VERSION
  # 2023-04-24 debian and pop!os have different nodejs versions
  NODE_VERSION=$(docker run discourse/base:release bash -c 'node --version'|cut -d'v' -f2)
  #NODE_VERSION=$(grep node ~/src/discourse-repos/discourse/.tool-versions|awk '{print $2}')
  echo "GOT NODEJS version: $NODE_VERSION"
  asdf install nodejs $NODE_VERSION
  asdf global nodejs $NODE_VERSION
  npm install -g yarn
  sleep 2
  # end of version updates
  cd $DISCOURSE_SRC
  git checkout main
  git pull
  bundle install
  ./bin/rake db:migrate
  RAILS_ENV=test ./bin/rake db:migrate
  git checkout main
  git pull
  bundle install
  yarn install
  ./bin/rake db:migrate
  RAILS_ENV=test ./bin/rake db:migrate
  exit
1 Like

Finally fixed it with

gem install bundler -v 2.5.3

Not sure why it didn’t know to install the version that it wanted.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.