2

我以为我在 Mac 上使用 rbenv 安装了 Compass,但在尝试切换 Codekit 以使用它而不是其内部编译器时出现错误。

compass -v在终端中运行给了我:

/.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `require': cannot load such file -- sass/script/node (LoadError)
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:35:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches/browser_support.rb:1:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:2:in `block in <top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `each'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions.rb:9:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass.rb:5:in `block in <top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass.rb:4:in `each'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass.rb:4:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/bin/compass:20:in `block in <top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/bin/compass:8:in `fallback_load_path'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/bin/compass:19:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/bin/compass:23:in `load'
from /.rbenv/versions/1.9.3-p392/bin/compass:23:in `<main>'

所以,那里似乎有问题,虽然运行gem install compass告诉我 compass-0.12.2 已成功安装。

我该如何解决问题并解决它?

4

3 回答 3

4

试试这个版本,

http://rubygems.org/gems/sass/versions/3.3.0.alpha.149

gem install sass -v 3.3.0.alpha.149 --pre

请记住,上面的命令会安装 gem,它不会激活版本!

您可以运行以下命令:

gem uninstall sass

系统会提示您提供已安装版本的列表;只需卸载 X 高于 149 的 3.3.0.alpha.X 即可。

您可以通过以下方式测试它是否有效:

sass --version
compass --version

您应该看到正常页面(而不是问题中的错误)。

附言。

你可能也需要这个:

gem install compass-sourcemaps -v 0.12.2.sourcemaps.57a186c --pre
于 2013-07-30T07:16:43.673 回答
3

就我而言,这是 compass 和 sass 之间的不兼容。它是通过 compass 依赖项自动安装的“sass-3.3.0.rc.2”。

所以我不得不删除 sass 版本gem uninstall sass并安装另一个版本gem install sass -v 3.2.12

之后,错误消失了。

于 2014-01-13T13:48:03.317 回答
0

指南针中的一个脚本中的某些导入存在问题。一个简单的修复,但现在你可以将它添加到你的 Gemfile 中(现在对我有用):

gem "compass", github: 'ovaskevich/compass'
于 2014-05-27T23:04:17.717 回答