Mac Osx和rbenv上的Grunt Contrib Compass错误

时间:2014-06-25 08:28:34

标签: ruby node.js macos rbenv

我在Mac Os 10.6上,我正在使用Yeoman角度生成器,Package.json内有grunt-contrib-compassgrunt-contrib-watch

我已安装rbenvcompasssass,而npm install的所有内容似乎都正确无误:

$: ruby -v
   ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin10.0]
$: compass -v
   Compass 0.12.6 (Alnilam)
$: sass -v 
   Sass 3.2.19 (Media Mark)

尽管如此,当我启动grunt serve时,我收到此错误,奇怪地指的是Ruby(1.8)的错误版本:

Warning: /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:135:in `gem_original_require': no such file to load -- sass/script/node (LoadError)
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:135:in `require'
from /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches/browser_support.rb:1
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:2
from /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `each'
from /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/sass_extensions.rb:9
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass.rb:5
from /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass.rb:4:in `each'
from /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass.rb:4
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/compass-0.12.2/bin/compass:20
from /Library/Ruby/Gems/1.8/gems/compass-0.12.2/bin/compass:8:in `fallback_load_path'
from /Library/Ruby/Gems/1.8/gems/compass-0.12.2/bin/compass:19
from /usr/bin/compass:23:in `load'
from /usr/bin/compass:23 Use --force to continue.

Aborted due to warnings.

Ruby 1.8是Snow Leopard上标准的预安装版本,所以我猜这个问题与rbenv更相关,即使一切看起来都很正确..

1 个答案:

答案 0 :(得分:0)

事实证明这是rbenv配置错误。 在我的bash_profile中,我在声明rbenv shim路径之后调用eval "$(rbenv init -)"方式,所以在添加了所有其他PATH之后。这对我有用:

export RBENV_ROOT="$HOME/.rbenv"

if [ -d $RBENV_ROOT ]; then
    PATH="~/.rbenv/shims:$PATH"
    eval "$(rbenv init -)"
fi