Aitzaz
Aitzaz

Reputation: 43

Facing issues with switching across various versions of PostgreSQL

I am working on a rails project which was set up with postgresql 14.4 and after some time I had to make the project use postgresql version 14.5.

I though that just upgrading the Psql version locally on my machine may fix the issue because I just had to change the minor version. So I updated the version using brew trough following commands

brew uninstall postgresql
brew install postgresql@14
brew services restart postgresql@14
brew link postgresql@14

After that I verified that the version of Postgres in my machine is 14.5 using the Psql -V command.

But now whenever I run the rails server or rails console, I get the following error message:

Traceback (most recent call last):
    46: from bin/rails:6:in `<main>'
    45: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:291:in `require'
    44: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:257:in `load_dependency'
    43: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:291:in `block in require'
    42: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    41: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    40: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    39: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    38: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    37: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/railties-5.2.5/lib/rails/commands.rb:18:in `<top (required)>'
    36: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/railties-5.2.5/lib/rails/command.rb:46:in `invoke'
    35: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/railties-5.2.5/lib/rails/command/base.rb:69:in `perform'
    34: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    33: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    32: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    31: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/railties-5.2.5/lib/rails/commands/server/server_command.rb:142:in `perform'
    30: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/railties-5.2.5/lib/rails/commands/server/server_command.rb:142:in `tap'
    29: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/railties-5.2.5/lib/rails/commands/server/server_command.rb:145:in `block in perform'
    28: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:291:in `require'
    27: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:257:in `load_dependency'
    26: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:291:in `block in require'
    25: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    24: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    23: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    22: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    21: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    20: from /Users/dev/Desktop/main-ginkgo/config/application.rb:7:in `<top (required)>'
    19: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bundler-2.2.19/lib/bundler.rb:174:in `require'
    18: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bundler-2.2.19/lib/bundler/runtime.rb:50:in `require'
    17: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bundler-2.2.19/lib/bundler/runtime.rb:50:in `each'
    16: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bundler-2.2.19/lib/bundler/runtime.rb:61:in `block in require'
    15: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bundler-2.2.19/lib/bundler/runtime.rb:61:in `each'
    14: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bundler-2.2.19/lib/bundler/runtime.rb:66:in `block (2 levels) in require'
    13: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:79:in `require'
    12: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:70:in `require_with_bootsnap_lfi'
    11: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    10: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:71:in `block in require_with_bootsnap_lfi'
     9: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:71:in `require'
     8: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/charlock_holmes-0.7.7/lib/charlock_holmes.rb:1:in `<top (required)>'
     7: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:291:in `require'
     6: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:257:in `load_dependency'
     5: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:291:in `block in require'
     4: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
     3: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
     2: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
     1: from /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require': dlopen(/Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/charlock_holmes-0.7.7/lib/charlock_holmes/charlock_holmes.bundle, 0x0009): Library not loaded: /usr/local/opt/icu4c/lib/libicudata.70.dylib (LoadError)
  Referenced from: /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/charlock_holmes-0.7.7/lib/charlock_holmes/charlock_holmes.bundle
  Reason: tried: '/usr/local/opt/icu4c/lib/libicudata.70.dylib' (no such file), '/usr/local/lib/libicudata.70.dylib' (no such file), '/usr/lib/libicudata.70.dylib' (no such file), '/usr/local/Cellar/icu4c/71.1/lib/libicudata.70.dylib' (no such file), '/usr/local/lib/libicudata.70.dylib' (no such file), '/usr/lib/libicudata.70.dylib' (no such file) - /Users/dev/.rvm/gems/ruby-2.5.9@ginkgo/gems/charlock_holmes-0.7.7/lib/charlock_holmes/charlock_holmes.bundle

Can anyone help me out in fixing this?

Upvotes: 0

Views: 277

Answers (1)

Aitzaz
Aitzaz

Reputation: 43

After trying everything possible related to postgreSQL, I was convinced that this has something to do with the gem called charlock_holmes (if there is any) so I just visited its GitHub repo and used the following commands mentioned at the bottom of README.md

brew install icu4c
bundle config build.charlock_holmes --with-icu-dir=/usr/local/opt/icu4c
gem install charlock_holmes -- --with-icu-dir=/usr/local/opt/icu4c

This worked for me!

Upvotes: 1

Related Questions