colorls icon indicating copy to clipboard operation
colorls copied to clipboard

`load_from_yaml': undefined method `safe_load' for Psych:Module

Open liavkoren opened this issue 6 years ago • 8 comments

Hi. I'm not really a rubist, so am not sure about the best way to investigate this. On starting a new bash session, I get:

/Library/Ruby/Gems/2.0.0/gems/colorls-0.1.7/lib/colorls/load_from_yaml.rb:4:in `load_from_yaml': undefined method `safe_load' for Psych:Module (NoMethodError)
	from /Library/Ruby/Gems/2.0.0/gems/colorls-0.1.7/lib/colorls/flags.rb:52:in `set_color_opts'
	from /Library/Ruby/Gems/2.0.0/gems/colorls-0.1.7/lib/colorls/flags.rb:5:in `initialize'
	from /Library/Ruby/Gems/2.0.0/gems/colorls-0.1.7/exe/colorls:4:in `new'
	from /Library/Ruby/Gems/2.0.0/gems/colorls-0.1.7/exe/colorls:4:in `<top (required)>'
	from /usr/local/bin/colorls:23:in `load'
	from /usr/local/bin/colorls:23:in `<main>'

As I said, I don't write ruby regularly, so I'm sure aspects of my ruby setup are out of date -- I had to upgrade rvm, and it took a few tries with brew before I managed to get ruby 2.4.1 installed.

This only happens on init, and colorls works fine other than that. It's a nice project, BTW. : )

liavkoren avatar Jul 14 '17 18:07 liavkoren

Hey @liavkoren, thanks for filing this issue. Check if gem update psych fixes the issue. 😄

athityakumar avatar Jul 14 '17 19:07 athityakumar

Still happens. Output from update and gem list:

$ gem update psych
Updating installed gems
Updating psych
Fetching: psych-2.2.4.gem (100%)
Building native extensions.  This could take a while...
Successfully installed psych-2.2.4
Parsing documentation for psych-2.2.4
Installing ri documentation for psych-2.2.4
Installing darkfish documentation for psych-2.2.4
Done installing documentation for psych after 2 seconds
Parsing documentation for psych-2.2.4
Done installing documentation for psych after 0 seconds
Gems updated: psych
$ gem list psych

*** LOCAL GEMS ***

psych (2.2.4, default: 2.2.2)

liavkoren avatar Jul 15 '17 02:07 liavkoren

gem update psych
gem update colorls

athityakumar avatar Jul 15 '17 06:07 athityakumar

gem update colorls It's a no-op.

liavkoren avatar Jul 15 '17 17:07 liavkoren

Same issue (never used ruby, so don't really know where to start):

> gem list

*** LOCAL GEMS ***

bigdecimal (1.2.0)
colorize (0.8.1)
colorls (0.1.7)
facets (3.1.0)
filesize (0.1.1)
io-console (0.4.2)
json (1.7.7)
psych (2.2.4, 2.0.0)
rdoc (4.0.0)
ruby-terminfo (0.1.1)

maxgrenderjones avatar Sep 06 '17 09:09 maxgrenderjones

Hmm, I see that 2 versions of psych are present and 2.0.0 is the one causing problem. Uninstall all versions of psych and try re-installing colorls?

gem uninstall colorls
gem uninstall psych
gem install colorls

athityakumar avatar Sep 06 '17 11:09 athityakumar

Well that turned out to be a bad idea 😄 - turns out rubygems needs psych to work at all, so once you uninstall it you break gem. And I'm on centos 7 where the official psych package is 2.0 (which supports puppet, which I can't uninstall) so I would appear to be stuck...

maxgrenderjones avatar Sep 06 '17 12:09 maxgrenderjones

Oops, sorry for that. But I'm pretty sure that it's definitely because of an older version of psych being used. For future purposes, maybe this needs to be specified in the colorls.gemspec file.

athityakumar avatar Sep 06 '17 15:09 athityakumar