rubyreact-nativebundlebundler

bundle install cannot load such file


When I try bundle install or RCT_NEW_ARCH_ENABLED=1 bundle exec pod install in my project I get this error. Mac on chip M2

/opt/homebrew/opt/ruby/bin/bundle:25:in `load': cannot load such file -- /opt/homebrew/Cellar/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.15/exe/bundle (LoadError)
        from /opt/homebrew/opt/ruby/bin/bundle:25:in `<main>'

I have already reinstalled gem, but it doesn't help: My ruby ver:

ruby 3.3.3 (2024-06-12 revision f1c7b6f435) [arm64-darwin23]
/opt/homebrew/opt/ruby/bin/ruby
/opt/homebrew/opt/ruby/bin/gem
gem list bundler 

*** LOCAL GEMS ***

bundler (default: 2.5.15)

.zpfofile:

eval "$(/opt/homebrew/bin/brew shellenv)"

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
exportPATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

if [ -d "/opt/homebrew/opt/ruby/bin" ]; then
  export PATH=/opt/homebrew/opt/ruby/bin:$PATH
  export PATH=`gem environment gemdir`/bin:$PATH
fi

Solution

  • I had the same issue today and it was that I had multiple versions of Bundler installed.

    I ran, gem uninstall bundler --all --force && gem install bundler and it resolved the issue for me.