ruby 安装后无法使用指南针
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21079342/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't use compass after installing it
提问by Ilyes512
I don't seem to be able to get compass working on Vagrant using this Vagrantfile. See the rest of the bash script's used right here(removed repo) (see Vaprobashif you want to provision your Vagrant Ubuntu Box!).
我似乎无法使用此 Vagrantfile使指南针在 Vagrant 上工作。请参阅此处使用的其余 bash 脚本(已删除 repo)(如果您想配置 Vagrant Ubuntu Box,请参阅Vaprobash!)。
So I was fallowing a gruntjs course, when I had to use grunt server. The only problem is that it needs a newer ruby version (1.9+ I believe instead of the 1.8) and it needs compass. So I have solved the ruby part by installing RVM and installing the latest stable version. Compass should be easy to get gem install compassand it does seem to be installed. But when I type in compass -vI get the fallowing error:
所以当我不得不使用grunt server. 唯一的问题是它需要更新的 ruby 版本(我相信 1.9+ 而不是 1.8)并且它需要指南针。所以我通过安装 RVM 并安装最新的稳定版本解决了 ruby 部分。指南针应该很容易获得,gem install compass而且它似乎已经安装好了。但是当我输入时,compass -v我收到了以下错误:
/home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- sass/script/node (LoadError)
from /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rvm/gems/ruby-2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches/browser_support.rb:1:in `<top (required)>'
from /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rvm/gems/ruby-2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:2:in `block in <top (required)>'
from /home/vagrant/.rvm/gems/ruby-2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `each'
from /home/vagrant/.rvm/gems/ruby-2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `<top (required)>'
from /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rvm/gems/ruby-2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions.rb:9:in `<top (required)>'
from /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rvm/gems/ruby-2.1.0/gems/compass-0.12.2/lib/compass.rb:5:in `block in <top (required)>'
from /home/vagrant/.rvm/gems/ruby-2.1.0/gems/compass-0.12.2/lib/compass.rb:4:in `each'
from /home/vagrant/.rvm/gems/ruby-2.1.0/gems/compass-0.12.2/lib/compass.rb:4:in `<top (required)>'
from /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rvm/gems/ruby-2.1.0/gems/compass-0.12.2/bin/compass:20:in `block in <top (required)>'
from /home/vagrant/.rvm/gems/ruby-2.1.0/gems/compass-0.12.2/bin/compass:8:in `fallback_load_path'
from /home/vagrant/.rvm/gems/ruby-2.1.0/gems/compass-0.12.2/bin/compass:19:in `<top (required)>'
from /home/vagrant/.rvm/gems/ruby-2.1.0/bin/compass:23:in `load'
from /home/vagrant/.rvm/gems/ruby-2.1.0/bin/compass:23:in `<main>'
from /home/vagrant/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `eval'
from /home/vagrant/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `<main>'
So I am not sure what is going wrong except for the error telling me it's missing files. Anyone got some hints to what could be the problem?
所以我不确定出了什么问题,除了错误告诉我它丢失了文件。有人对可能是什么问题有一些提示吗?
.bash_profile contains the path info:
.bash_profile 包含路径信息:
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
rvm -vand ruby -vwork just fine and after installing gem install compasssass -vseem to work as well.
rvm -v并且ruby -v工作得很好,安装后gem install compasssass -v似乎也能正常工作。
You can replicate everything using Vagrant and VirtualBox. Just download the Vagrantfile from my github mentioned above and vagrant up.
您可以使用 Vagrant 和 VirtualBox 复制所有内容。只需从我上面提到的 github 和vagrant up.
回答by Ilyes512
I asked for help on the official compass Github issue's page and got the answer for this problem.
我在官方指南针 Github 问题页面上寻求帮助,并得到了这个问题的答案。
The GitHub issue is right here.
GitHub 问题就在这里。
How to fix this:
如何解决这个问题:
When installing compass (v0.12.2), it will download the latest sass v3.3.0.rc3 (cause it's a dependency), but compass won't work with the latest sass. You either upgrade compass to the latest alpha version (0.13.*) or downgrade sass to 3.2.*. I choose the last one:
安装 compass (v0.12.2) 时,它会下载最新的 sass v3.3.0.rc3(因为它是一个依赖项),但是 compass 不能与最新的 sass 一起使用。您要么将指南针升级到最新的 alpha 版本 (0.13.*),要么将 sass 降级到 3.2.*。我选择最后一个:
gem uninstall sass --version 3.3.0.rc.3
gem install sass --version 3.2.18
compass -v # Working :)
Make sure you use the version you got installed. Find out by typing this:
确保使用您安装的版本。通过键入以下内容找出:
sass --version
回答by mpapis
have a look at this answer https://stackoverflow.com/a/21082978/497756- it was for other problem but should solve yours too.
看看这个答案https://stackoverflow.com/a/21082978/497756- 这是其他问题,但也应该解决你的问题。

