Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YAML safe loading is not available

When I want to install compass with gem install compass, I occurred with this error:

YAML safe loading is not available. 
Please upgrade psych to a version that supports safe loading (>= 2.0).

what The cause of this error and how can I solve the problem?

like image 644
Morteza QorbanAlizade Avatar asked Oct 24 '17 05:10

Morteza QorbanAlizade


2 Answers

It sounds like the psych gem needs to be updated. Try running gem install psych and then gem update psych.

Suggested by looking at the psych readme file here: https://github.com/ruby/psych/blob/master/README.md

EDIT: you might also have to update your version of ruby. This depends on how you have installed ruby, but @ewerx has one suggestion in their answer.

like image 125
Scott Newson Avatar answered Oct 03 '22 01:10

Scott Newson


To resolve this I first upgraded Ruby from 2.0.x to 2.4.2 (https://gorails.com/setup/osx/10.12-sierra):

rbenv install 2.4.2; rbenv global 2.4.2

Then updated gems:

sudo gem update --system; gem update

It may be sufficient to just update gems.

like image 6
ewerx Avatar answered Oct 03 '22 00:10

ewerx