2

我在 Ubuntu Oneiric 上安装了 Compass 0.12(一个 ruby​​ gem),没有问题我已经更新为精确格式化 / 并保持 /home,所以我需要重新安装 ruby​​(1.9.3)。

我现在在编译 SCSS 文件时收到此错误:

compass watch --trace

            Change detected at 12:45:09 to: style.scss overwrite css/style.css

Dear developers making use of FSSM in your projects, FSSM is essentially dead at this point. Further development will be taking place in the new shared guard/listen project. Please let us know if you need help transitioning! ^_^b - Travis Tilley

>>> Compass is polling for changes. Press Ctrl-C to Stop.
ArgumentError on line ["46"] of /usr/lib/ruby/1.9.1/pathname.rb: invalid byte sequence in US-ASCII
  /usr/lib/ruby/1.9.1/pathname.rb:46:in `chop_basename'
  /usr/lib/ruby/1.9.1/pathname.rb:102:in `cleanpath_aggressive'
  /usr/lib/ruby/1.9.1/pathname.rb:90:in `cleanpath'
  /usr/lib/ruby/1.9.1/pathname.rb:452:in `relative_path_from'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/path.rb:82:in `split_path'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/path.rb:70:in `run_callback'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/path.rb:56:in `callback_action'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/path.rb:36:in `update'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/state/directory.rb:39:in `block in modified'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/state/directory.rb:37:in `each'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/state/directory.rb:37:in `modified'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/state/directory.rb:18:in `refresh'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/backends/polling.rb:17:in `block (2 levels) in run'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/backends/polling.rb:17:in `each'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/backends/polling.rb:17:in `block in run'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/backends/polling.rb:15:in `loop'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/backends/polling.rb:15:in `run'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm/monitor.rb:26:in `run'
  /var/lib/gems/1.9.1/gems/fssm-0.2.9/lib/fssm.rb:70:in `monitor'
  /var/lib/gems/1.9.1/gems/compass-0.12.1/lib/compass/commands/watch_project.rb:89:in `perform'
  /var/lib/gems/1.9.1/gems/compass-0.12.1/lib/compass/commands/base.rb:18:in `execute'
  /var/lib/gems/1.9.1/gems/compass-0.12.1/lib/compass/commands/project_base.rb:19:in `execute'
  /var/lib/gems/1.9.1/gems/compass-0.12.1/lib/compass/exec/sub_command_ui.rb:43:in `perform!'
  /var/lib/gems/1.9.1/gems/compass-0.12.1/lib/compass/exec/sub_command_ui.rb:15:in `run!'
  /var/lib/gems/1.9.1/gems/compass-0.12.1/bin/compass:29:in `block in <top (required)>'
  /var/lib/gems/1.9.1/gems/compass-0.12.1/bin/compass:43:in `call'
  /var/lib/gems/1.9.1/gems/compass-0.12.1/bin/compass:43:in `<top (required)>'
  /usr/local/bin/compass:19:in `load'
  /usr/local/bin/compass:19:in `<main>'

(“亲爱的开发人员”消息是输出的一部分)。

我第一次更改 scss 文件时不会出现此错误,而是第二次出现此错误。

此外,罗盘在某些文件中“吃掉”一个“s”,而不是将它们编译为“style.css”(文件名应该是什么),而是将它们编译为“tyle.css”。

我在这里花了 3 个小时查看类似的问题,但我无法解决。我尝试在某些文件的顶部包含 # encoding: utf-8 ,但没有成功。

请逐步解释我应该怎么做,因为我完全是 Ruby 的菜鸟(我只是因为 SASS 而使用它)。

4

2 回答 2

2

我认为路径名有问题,可能它包含无效的非 ASCII 序列;可能吃掉的“s”是问题所在,可能是无效字符,或者可能是靠近它的字符;尝试确保路径是 ASCII。

或者可能是精确 readline 包中的错误?尝试通过 RVM 安装 ruby​​ 1.9.3,RVM 应该使用与其捆绑的 readline(详见下面的评论)

于 2012-05-12T01:06:20.880 回答
2

据我所知,有问题的文件pathname.rb包含这个似乎是问题所在的函数:

def chop_basename(path)
  base = File.basename(path)
  if /\A#{SEPARATOR_PAT}?\z/o =~ base
    return nil
  else
    return path[0, path.rindex(base)], base
  end
end
private :chop_basename

这是具有相同问题的类似问题的链接:

当应用程序路径中有非 ASCII 字符时,Ruby on Rails 应用程序不会开始使用Passenger

所以修复显然是坚持使用 us-ascii 路径名。

这是该类文档中的一个片段:

Pathname 表示在文件系统中定位文件的路径名。路径名取决于操作系统:Unix、Windows 等。路径名库与本地操作系统的路径名一起使用。但是,实验性地支持非 Unix 路径名。

至于为什么它以前有效而现在无效,这很难说。可能是您系统上的其他一些库发生了更改,或者升级到 ruby​​ 1.9.3 导致了导致错误的微小更改。

于 2012-05-17T01:22:34.280 回答