csscss terminates with syntax error
Closed this issue · 13 comments
I have no knowledge of Ruby, but csscss terminates on my machine with the following error:
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': /usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:29: syntax error, unexpected tSYMBEG, expecting kDO or '{' or '(' (SyntaxError)
sass_options = {cache:false}
^
/usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:45: syntax error, unexpected ':', expecting ')'
...ontents).redundancies(minimum: @minimum,
^
/usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:46: syntax error, unexpected ':', expecting '='
... ignored_properties: @ignored_properties,
^
/usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:47: syntax error, unexpected ':', expecting '='
... ignored_selectors: @ignored_selectors)
^
/usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:63: syntax error, unexpected tSYMBEG, expecting kDO or '{' or '('
...eport(verbose:@verbose, color:true)
^
/usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:67: syntax error, unexpected kRESCUE, expecting kEND
rescue Parslet::ParseFailed => e
^
/usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:67: syntax error, unexpected tASSOC
rescue Parslet::ParseFailed => e
^
/usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:79: syntax error, unexpected kDO_BLOCK, expecting kEND
opts = OptionParser.new do |opts|
^
/usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:83: syntax error, unexpected kDO_BLOCK, expecting kEND
opts.on("-v", "--[no-]verbose", "Display each rule") do |v|
^
/usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:87: syntax error, unexpected kDO_BLOCK, expecting kEND
opts.on("--[no-]color", "Colorizes output") do |c|
^
/usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:91: syntax error, unexpected kDO_BLOCK, expecting kEND
...many rules. Defaults to 3") do |n|
^
/usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:95: syntax error, unexpected kDO_BLOCK, expecting kEND
...ties when finding matches") do |ignored_properties|
^
/usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb:99: syntax error, unexpected kDO_BLOCK, expecting $end
...tors when finding matches") do |ignored_selectors|
^
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss.rb:11
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/bin/csscss:3
from /usr/bin/csscss:19:in `load'
from /usr/bin/csscss:19
I installed via sudo gem install csscss
, and Sass was already there.
Hey @Boldewyn that's because you're running it with ruby v1.8.x. Try installing 1.9.x+ and giving it a shot.
Ruby v1.8.x is at its "end of life" and will sunset soon so it won't receive any new updates (especially security updates).
My Debian uses Ruby 1.9, unfortunately:
$ ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
I'm guessing your gem
command is using an older version of ruby. You can check this out by running gem environment
Seeing /usr/lib/ruby/gems/1.8/gems/csscss-1.0.0/lib/csscss/cli.rb
in your backtrace tips me off to that.
If you run which ruby
it should give you a path that includes a different gem
command that you can run (the version that is used by 1.9.x).
OK, that was indeed the problem. Somehow I had /usr/local/bin/gem linked to /usr/bin/gem1.8 for whatever reason. Re-installing with the 1.9 gem fixed it. Thanks!
I have a similar issue.
$ export GEM_HOME=/Library/Ruby/Gems/1.8
$ gem list
*** LOCAL GEMS ***
bigdecimal (1.1.0)
blankslate (2.1.2.4)
colorize (0.5.8)
csscss (1.0.0)
io-console (0.3)
json (1.7.7, 1.5.4)
minitest (2.5.1)
parslet (1.5.0)
rake (0.9.2.2)
rdoc (3.9.4)
require (0.2.7)
rubygems-update (2.0.3)
$ which csscss
/usr/bin/csscss
$ sudo gem uninstall csscss -Vxa
$ gem list
*** LOCAL GEMS ***
bigdecimal (1.1.0)
blankslate (2.1.2.4)
colorize (0.5.8)
csscss (1.0.0)
io-console (0.3)
json (1.7.7, 1.5.4)
minitest (2.5.1)
parslet (1.5.0)
rake (0.9.2.2)
rdoc (3.9.4)
require (0.2.7)
rubygems-update (2.0.3)
It will not uninstall it from the 1.8 gem. If I can get it uninstalled from there, then I can use the new gem I already have installed. Unfortunately installing csscss to the new gem will not override the 1.8 version due to the executable being in /usr/bin/.
Oh and I used the -i switch to specify ~/.gem location as well but it's not in that location anyway.
My problem is not because of the Ruby version. I have 1.9 installed already. I need to get csscss off the 1.8 installation.
$ ruby -version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin12.3.0]
-e:1:in <main>': undefined local variable or method
rsion' for main:Object (NameError)
My problem is not because of the Ruby version. I have 1.9 installed already. I need to get csscss off the 1.8 installation.
gem uninstall csscss
should work if that's not working, then it looks like your gem
paths are crossed with 1.8 and 1.9.
I recommend gem environment
and which gem
to help figure that out.
@kevboutin @zmoazeni someone asked in another thread how i uninstalled the 1.8 gem and installed the 1.9:
I used the 1.8 bin that ships with Mac OS and since my 1.9 version is used when just typing 'ruby', i called the system ruby with the full path:
sudo /usr/bin/gem uninstall csscss
and after that just install again with your shiny new 1.9 (in my case installed via brew):
gem install csscss
@kevboutin @nilsborchers I'd also recommend looking into rvm, rbenv, or chruby. Installing and dealing with multiple rubies can be a pain and these make it much much easier.
Awesome... thanks! I have it working now.
in my case on ubuntu, I need to remove /usr/bin/csscss MANUALLY before I can install csscss correctly AFTER setting ruby and gem with
update-alternatives --config ruby
and
update-alternatives --config gem
to 1.9