Thabo Mapohosha
Thabo Mapohosha

Reputation: 11

Why do I get a `Psych::SyntaxError` when I run the command `gem`?

I'm getting the following error when I execute any gem command. For example:

gem update --system.

C:/Ruby193/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): could not find expected ':' while scanning a simple key at line 2 column 1 (Psych::SyntaxError)
  from C:/Ruby193/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
  from C:/Ruby193/lib/ruby/1.9.1/psych.rb:151:in `parse'
  from C:/Ruby193/lib/ruby/1.9.1/psych.rb:127:in `load'
  from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:253:in `load_file'
  from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:191:in `initialize'
  from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:78:in `new'
  from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:78:in `do_configuration'
  from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:51:in `run'
  from C:/Ruby193/bin/gem:30:in `<main>'

I've installed Ruby using the Windows Ruby installer. After the installation, I executed the command to check if it is installed:

$ ruby -v
ruby 1.9.3p545 (2014-02-24) [i386-mingw32]

So far so good. The problem arises whenever I run the command gem. Can anyone help me solving this problem?

Upvotes: 1

Views: 848

Answers (1)

Stephen
Stephen

Reputation: 727

Psych is used by YAML.load to load and parse yaml files. The error is telling you that there is a syntax error in the yaml file that is being loaded in config_file.rb:253 in the load_file method. The config file may have been corrupted.

Other than that, maybe just reinstall with rvm or another version manager. Here is a link for rvm on windows.

Upvotes: 1

Related Questions