0

I am getting the error below when trying to run the application, so not sure how to solve it.

$ rails s
Traceback (most recent call last):
    5: from bin/rails:2:in `<main>'
    4: from bin/rails:2:in `load'
    3: from /Users/jolienai/Documents/github.com/railsfriends/friends/bin/spring:3:in `<top (required)>'
    2: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_gem.rb:62:in `gem'
    1: from /Library/Ruby/Site/2.6.0/rubygems/dependency.rb:323:in `to_spec'
/Library/Ruby/Site/2.6.0/rubygems/dependency.rb:313:in `to_specs': Could not find 'bundler' (2.2.24) required by your /Users/jolienai/Documents/github.com/railsfriends/friends/Gemfile.lock. (Gem::MissingSpecVersionError)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.2.24`
Checked in 'GEM_PATH=/Users/jolienai/.gem/ruby/2.6.0:/Library/Ruby/Gems/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0' , execute `gem env` for more information
~/Documents/github.com/railsfriends/friends $ 

I tried the command below but got another error

$ gem install bundler:2.2.24
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted @ apply2files - /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.24/CHANGELOG.md
$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 3.2.24
  - RUBY VERSION: 3.0.2 (2021-07-07 patchlevel 107) [x86_64-darwin20]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/3.0.0
  - USER INSTALLATION DIRECTORY: /Users/jolienai/.gem/ruby/3.0.0
  - RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/3.0.0/bin
  - SPEC CACHE DIRECTORY: /Users/jolienai/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/3.0.2/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-darwin-20
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/3.0.0
     - /Users/jolienai/.gem/ruby/3.0.0
     - /usr/local/Cellar/ruby/3.0.2/lib/ruby/gems/3.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/opt/ruby/bin
     - /Users/jolienai/google-cloud-sdk/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /usr/local/go/bin
     - /usr/local/share/dotnet
     - ~/.dotnet/tools
     - /Library/Frameworks/Mono.framework/Versions/Current/Commands
     - /Users/jolienai/.rvm/bin
```
rmlockerd
  • 3,776
  • 2
  • 15
  • 25
J. Viégas
  • 135
  • 1
  • 11
  • try with sudo. this will be a quick solution. but a better approach would be keeping system ruby clean. thus, you need to install rvm or rbenv. then install desired ruby version, gems etc. https://rvm.io/rvm/install – marmeladze Jul 21 '21 at 17:56
  • That looks like ruby installed via homebrew rather than system ruby (which is 2.6.3), but agree w/the suggestion you install rvm or rbenv, which you can do via homebrew. In addition to managing multiple versions, they store your gems under your user directory so do `sudo` access is required. – rmlockerd Jul 21 '21 at 18:13
  • I am working on a mac so it already had the ruby installed. I also have the rvm 1.29.10 (latest)installed. – J. Viégas Jul 22 '21 at 13:11

2 Answers2

0

Just had the same issue, I deleted the Gemfile.lock and installed the bundle.

rm Gemfile.lock
bundle install
Mike.R
  • 2,824
  • 2
  • 26
  • 34
0

I've ended up elaborating the following scheme to work around this ugly error (message):

gem list // you got local gems List  *** LOCAL GEMS ***

Now

 gem install bundler 

Once bundler install start install new added bundlers

bundle install

Now all done and working just install your pod. Pod install time error solved

pod install