Linux 如何使用 rvm 和 gem 安装和运行指南针?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9904389/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 05:27:15  来源:igfitidea点击:

How to install and run compass with rvm and gem?

rubylinuxgeminstallrvm

提问by iron9light

OS: Mint Linux 11 64bit

操作系统:Mint Linux 11 64 位

I know nothing about ruby, I just want Compass.

我对红宝石一无所知,我只想要指南针。

I've installed rvm and ruby 1.9.3, and set the default ruby

我已经安装了 rvm 和 ruby​​ 1.9.3,并设置了默认的 ruby

$ rvm list

rvm rubies

=* ruby-1.9.3-p125 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

I've installed compass via gem

我已经通过 gem 安装了指南针

$ gem list

*** LOCAL GEMS ***

bundler (1.1.3)
chunky_png (1.2.5)
compass (0.12.1)
fssm (0.2.8.1)
rake (0.9.2)
rubygems-bundler (0.2.8)
sass (3.1.15)

But I cannot run compass, because gem/bin is not in $PATH

但我无法运行compass,因为 gem/bin 不在 $PATH 中

I added it to $PATH and run compass again:

我将它添加到 $PATH 并再次运行指南针:

$ compass
/home/il/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find compass (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
from /home/il/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/il/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1230:in `gem'
from /home/il/.rvm/gems/ruby-1.9.3-p125/bin/compass:18:in `<main>'

Can anyone help please?

有人可以帮忙吗?

采纳答案by iron9light

$ rvm wrapper 1.9.3@compass --no-prefix compass

$ rvm wrapper 1.9.3@compass --no-prefix compass

回答by Allan

assuming that rvm is installed you could do something like:

假设安装了 rvm,您可以执行以下操作:

$ rvm install 2.1.1
$ rvm @global do gem install compass

No need to do sudo.

无需执行 sudo。