当前位置: 首页>>技术教程>>正文


ruby – 安装指南针后无法使用

, , , ,

问题描述

我似乎无法使用this Vagrantfile在Vagrant上使用指南针。在此处查看bash脚本其余部分的使用(已删除的存储库)(如果要配置Vagrant Ubuntu Box,请参阅Vaprobash!)。

因此,当我不得不使用grunt server时,我不喜欢gruntjs课程。唯一的问题是,它需要较新的红 gems 版本(我相信是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>'

因此,除了错误告诉我丢失的文件外,我不确定什么地方出了问题。任何人都暗示可能是什么问题?

.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 -vruby -v可以正常工作,并且在安装gem install compass之后,sass -v也可以正常工作。

您可以使用Vagrant和VirtualBox复制所有内容。只需从上述我的github和vagrant up下载Vagrantfile。

最佳回答

我在罗盘官方指南页面上寻求帮助,并获得了该问题的答案。

GitHub问题是here

如何解决这个问题:

安装指南针(v0.12.2)时,它将下载最新的sass v3.3.0.rc3(因为它是一个依赖项),但是指南针不适用于最新的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 :)

确保使用安装的版本。通过键入以下内容进行查找:

sass --version

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/9658.html,未经允许,请勿转载。