我如何运行Ruby Gem?

时间:2022-10-30 08:08:32

This might seem stupid, but I recently tried to install SASS and followed their instructions:

这可能看起来很愚蠢,但我最近尝试安装SASS并遵循他们的指示:

$ gem install sass 
$ sass --watch [...]

So I followed along:

所以我跟着:

root@server:~# gem install sass
Successfully installed sass-3.1.15
1 gem installed
Installing ri documentation for sass-3.1.15...
Installing RDoc documentation for sass-3.1.15...

root@server:~# sass
bash: sass: command not found

Despite looking around like an idiot trying to find some simple way to run something like gem run sass or some other workaround to make it function, I am more or less at a loss.

尽管环顾四周就像一个白痴试图找到一些简单的方法来运行像gem run sass或其他一些解决方法来使其运行,但我或多或少都不知所措。

2 个解决方案

#1


9  

It seems that Debian/Ubuntu drops ruby gems into /var/lib/gems/1.8/bin.

似乎Debian / Ubuntu将ruby gems放入/var/lib/gems/1.8/bin。

So the solution (at least for Ubuntu/Debian) is:

所以解决方案(至少对于Ubuntu / Debian)是:

$ sudo -s
# echo 'PATH=/var/lib/gems/1.8/bin:$PATH' > /etc/profile.d/gemspath.sh
# chmod 0755 /etc/profile.d/gemspath.sh

...and then open a new shell session.

...然后打开一个新的shell会话。

(This is fixed in Ubuntu 11.10.)

(这在Ubuntu 11.10中已得到修复。)

#2


6  

If you happen to have installed Ruby through rbenv, you'll need to execute the following command

如果您碰巧通过rbenv安装了Ruby,则需要执行以下命令

rbenv rehash

rbenv rehash

#1


9  

It seems that Debian/Ubuntu drops ruby gems into /var/lib/gems/1.8/bin.

似乎Debian / Ubuntu将ruby gems放入/var/lib/gems/1.8/bin。

So the solution (at least for Ubuntu/Debian) is:

所以解决方案(至少对于Ubuntu / Debian)是:

$ sudo -s
# echo 'PATH=/var/lib/gems/1.8/bin:$PATH' > /etc/profile.d/gemspath.sh
# chmod 0755 /etc/profile.d/gemspath.sh

...and then open a new shell session.

...然后打开一个新的shell会话。

(This is fixed in Ubuntu 11.10.)

(这在Ubuntu 11.10中已得到修复。)

#2


6  

If you happen to have installed Ruby through rbenv, you'll need to execute the following command

如果您碰巧通过rbenv安装了Ruby,则需要执行以下命令

rbenv rehash

rbenv rehash