YAML safe loading is not available
Asked Answered
A

3

20

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?

Avernus answered 24/10, 2017 at 5:43 Comment(0)
A
13

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.

Abuttal answered 26/10, 2017 at 12:58 Comment(2)
What version of ruby and what version of the psych gem do you have?Abuttal
You might also have to upgrade ruby. How did you install ruby in the first place?Abuttal
M
6

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.

Mimesis answered 29/10, 2017 at 19:2 Comment(0)
C
-1

The following part of the post on https://gorails.com/setup/osx/10.12-sierra solved my issue.

We will be setting up a Ruby on Rails development environment on macOS 10.12 Sierra.

Older versions of OS X are mostly compatible so follow along as far as you can and then Google search for any problems you run into. There are plenty of people who have documented solutions for them.

Installing Homebrew First, we need to install Homebrew. Homebrew allows us to install and compile software packages easily from source.

Homebrew comes with a very simple install script. When it asks you to install XCode CommandLine Tools, say yes.

Open Terminal and run the following command:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Installing Ruby Choose the version of Ruby you want to install:

Now that we have Homebrew installed, we can use it to install Ruby.

We're going to use rbenv to install and manage our Ruby versions.

To do this, run the following commands in your Terminal:

brew install rbenv ruby-build

Add rbenv to bash so that it loads every time you open a terminal

echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile source ~/.bash_profile

Install Ruby

rbenv install 2.5.1

rbenv global 2.5.1

ruby -v

Casease answered 8/9, 2018 at 11:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.