2

I created a Rails/React app with Webpacker on my Mac running Ruby 2.5.3 and it runs without issue. However when I clone it to my Ubuntu 18.04 machine, I get the below error :

/usr/lib/ruby/2.5.0/yaml.rb:5: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.

My Ubuntu machine is also running Ruby 2.5.3, so I'm confused why it references 2.5.0 in the error.

I am able to launch the Rails server with rails s, but when I try to launch the full app with foreman start -f Procfile.dev, I get the error. I've tried reinstalling libyaml and all the Ruby versions on my machine with RVM with no impact on the error. I've also changed my local Ruby version to 2.5.0, and I get a different error message about how my machine is running Ruby 2.5.0 but the project is running 2.5.3.

Procfile.dev file:

rails: bundle exec rails s
webpack: ./bin/webpack-dev-serer
Daniel
  • 155
  • 2
  • 12
  • 1
    Gems are often locked to the lowest version in a "minor" series, so all 2.5.x gems go into 2.5.0 and so on. This means when you update to 2.5.x+1 you don't need to reinstall everything. – tadman Jul 15 '19 at 22:39

2 Answers2

1

It says the project is running 2.5.0 based on a directive like ruby '~> 2.5' in the Gemfile. Try changing that to the actual version you're running, run bundle to setup Gemfile.lock again, and retry the command.

mahemoff
  • 44,526
  • 36
  • 160
  • 222
  • The Gemfile and Gemfile.lock both refernce the Ruby build as 2.5.3p105, I wasn't able to find any reference to 2.5 or 2.5.0 unfortunately. – Daniel Jul 16 '19 at 14:30
0

I had Ruby 2.5.1 installed from ‘sudo apt install Ruby’ and 2.5.3 installed from RVM. I wiped all installed Rubies and RVM, reinstalled 2.5.3 via RVM on the root directory and was good to go.

Daniel
  • 155
  • 2
  • 12
  • Running "gem uninstall psych" from the command line resolved this for me. The gem wasn't missing. In my case, there were two conflicting versions of the gem installed after switching to ruby 3.1.2 in RVM and my Gemfile (psych-3.3.4 from the previous ruby install and psych-4.0.3 for the new version). – mcmaddox Mar 01 '23 at 11:06