Reputation: 987
This is the first time I've attempted to work with Ruby. I wanted to install sass
so I updated gem and attempt to install sass but was thrown an error. I then realized that the syntax error was raised whenever I ran gem
- I can't figure out what could be causing this and all other similar cases happen to people in their code, not when they just run the command.
I haven't touched the source code or even used the gem command up to this point. The error is a syntaxerror, specifically:
$ gem
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': /Library/Ruby/Gems/2.0.0/gems/psych-3.0.0/lib/psych/scalar_scanner.rb:146: syntax error, unexpected tIDENTIFIER, expecting ')' (SyntaxError)
klass.new(yy, m, dd, hh, mm, ss+us/(1_000_000r), offset)
^
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/psych-3.0.0/lib/psych/nodes/node.rb:4:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/psych-3.0.0/lib/psych/nodes.rb:2:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/psych-3.0.0/lib/psych.rb:14:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems.rb:585:in `load_yaml'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/config_file.rb:314:in `load_file'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/config_file.rb:191:in `initialize'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:66:in `new'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:66:in `do_configuration'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:46:in `run'
from /usr/bin/gem:21:in `<main>'
Upvotes: 1
Views: 561
Reputation: 369458
This is a known bug in the gemspec of Psych 3.0.0, which lists the required Ruby version as >= 1.9.2
, even though Psych 3.0.0 actually requires Ruby 2.2.2 (the specific syntax that causes the error in your case was introduced in Ruby 2.1):
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
The problem has been fixed in the repository, but there has not yet been a release incorporating that fix.
The necessary steps to fix your problem are mentioned in the bug report, basically you need to delete the b0rked Psych 3.0.0 gem directory manually, then you can uninstall Psych 3.0.0, and after that, you need to ensure that you don't install 3.0.0 again:
FYI, for anyone landing on the issue as described in the first post, where even the
gem
command won't even work:
- You must
rm -rf
psych 3.0.0's gem directory. (after that, the gem command should work)- Then you can do
gem uninstall psych -v 3.0.0
.- Then, until version 3.0.0 gets fixed, you must add
gem 'psych', '< 3.0.0'
to your Gemfile.- You might have to run
bundle update
for it to accept your change of psych's version.
Upvotes: 3