WebSpace 上安装的指南针:找不到命令

Compass Installed on WebSpace: Command not found

我想在托管服务器上的我的网站空间中使用 Compass(无根访问权限)。我遵循了托管公司提供的教程,但到目前为止没有成功:

在我的主目录中,我创建了一个 .gem 目录和一个 .gemrc 文件:

/* .gemrc in home dir */

gemhome: &GemHome /my/home/dir/.gem
gempath:
   - *GemHome
   - /usr/lib/ruby/gems/1.8

.bashrc 文件:

export GEM_HOME=/my/home/dir/.gem
export GEM_PATH=/my/home/dir/.gem:/usr/lib/ruby/gems/1.8

重新连接后的一些检查:

[~] echo $GEM_HOME
/my/home/dir/.gem

[~] echo $GEM_PATH
/my/home/dir/.gem:/usr/lib/ruby/gems/1.8

[~] echo $PATH
?/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

正在安装指南针

[~] gem install compass

Successfully installed compass-core-1.0.3
Successfully installed compass-import-once-1.0.5
Successfully installed chunky_png-1.3.5
Successfully installed rb-fsevent-0.9.6
Successfully installed ffi-1.9.10
Successfully installed rb-inotify-0.9.5
Successfully installed compass-1.0.3
7 gems installed

检查安装

[~] gem list compass -d

*** LOCAL GEMS ***

compass (1.0.3)
    Authors: Chris Eppstein, Scott Davis, Eric M. Suzanne, Brandon
    Mathis, Nico Hagenburger
    Homepage: http://compass-style.org
    Installed at: /my/home/dir/.gem

    A Real Stylesheet Framework

compass-core (1.0.3)
    Authors: Chris Eppstein, Scott Davis, Eric M. Suzanne, Brandon
    Mathis
    Homepage: http://compass-style.org/reference/compass/
    License: MIT
    Installed at: /my/home/dir/.gem

    The Compass core stylesheet library

compass-import-once (1.0.5)
    Author: Chris Eppstein
    Homepage:
    https://github.com/chriseppstein/compass/tree/master/import-once
    License: MIT
    Installed at: /my/home/dir/.gem

    Speed up your Sass compilation by making @import only import each
    file once.


[~] gem which compass
/my/home/dir/.gem/gems/compass-1.0.3/lib/compass.rb

但是无法使用指南针:

[~] compass
-bash: compass: command not found

知道我还需要做什么才能获得指南针 运行 吗?我发现了关于该主题的其他几个讨论,但所有解决方案都针对具有根访问权限的服务器。由于我没有服务器的根访问权限:还有其他解决方案吗?

编辑:更多信息

ls -al ~/.gem
total 32
drwxr-x---  8 u100170 nobody 4096 Nov 19 08:43 .
drwx--x--- 11 u100170 nobody 4096 Nov 19 09:13 ..
drwxr-x---  2 u100170 nobody 4096 Nov 19 08:49 bin
drwxr-x---  2 u100170 nobody 4096 Nov 19 08:49 cache
drwxr-x---  9 u100170 nobody 4096 Nov 19 08:49 doc
drwxr-x--- 10 u100170 nobody 4096 Nov 19 08:49 gems
drwxr-x---  2 u100170 nobody 4096 Nov 19 08:49 specifications
drwxr-x---  3 u100170 nobody 4096 Nov 19 08:43 specs

cd ~/.gem/gems/compass-1.0.3/lib/
ls -al
drwxr-x--- 3 u100170 nobody 4096 Nov 19 08:49 .
drwxr-x--- 6 u100170 nobody 4096 Nov 19 08:49 ..
drwxr-x--- 9 u100170 nobody 4096 Nov 19 08:49 compass
-rw-r--r-- 1 u100170 nobody  676 Nov 19 08:49 compass.rb

compass
-bash: compass: command not found

您的 .gem 位置没有附加到您的环境变量中。从输出 echo $PATH 可以看出,它没有附加到您的 $PATH 环境变量中。

尝试将其附加到您的 $PATH 变量

export GEM_HOME=/my/home/dir/.gem/bin
export GEM_PATH=/my/home/dir/.gem:/usr/lib/ruby/gems/1.8

PATH=$PATH:GEM_HOME:GEM_PATH
export PATH

最后做一个source ~/.bashrc

更新

将正确的可执行文件路径附加到 $PATH 环境变量将使您的可执行文件在 shell 环境中可用。

在此特定场景中,可执行文件位置为 /my/home/dir/.gem/bin