简体   繁体   English

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

[英]Compass Installed on WebSpace: Command not found

I want to use Compass in my webspace on a hosted server (no root access).我想在托管服务器上的网络空间中使用 Compass(无 root 访问权限)。 I followed tutorial provided by the hosting company but had no success so far:我按照托管公司提供的教程进行操作,但到目前为止没有成功:

In my home dir I created a.gem dir and a.gemrc file:在我的主目录中,我创建了 a.gem 目录和 a.gemrc 文件:

/* .gemrc in home dir */

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

The.bashrc file: .bashrc 文件:

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

Some checks after re-connecting:重新连接后的一些检查:

[~] 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

Installing Compass安装指南针

[~] 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

Check installation检查安装

[~] 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

But Compass cannot be used:但指南针不能使用:

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

Any idea what else I have to do to get compass running?知道我还需要做什么才能让指南针运行吗? I found several other discussions about this topic but all solutions targeted servers with root access.我发现了有关此主题的其他几个讨论,但所有解决方案都针对具有 root 访问权限的服务器。 Since I do not have root access to the server: Any other solutions?由于我没有对服务器的 root 访问权限:还有其他解决方案吗?

EDIT: Some more information编辑:更多信息

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

Your .gem location is not appended to your environmental variable. 您的.gem位置不会附加到您的环境变量中。 As seen from the output echo $PATH it isn't appended to your $PATH environmental variable. 从输出echo $PATH可以看出,它没有附加到$PATH环境变量中。

Try appending it to your $PATH variable 尝试将其附加到$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

Finally do a source ~/.bashrc 最后做一个source ~/.bashrc

Update 更新资料

Appending the correct executable path to the $PATH environment variable will make your executable available within the shell environment. 将正确的可执行文件路径附加到$PATH环境变量将使您的可执行文件在Shell环境中可用。

In this specific scenario the executable location is /my/home/dir/.gem/bin 在这种特定情况下,可执行文件位置为/my/home/dir/.gem/bin

I knwow the post is dating, but after passing time to find help on the web, it was the more proach of my pb.我知道这篇文章是约会的,但是在经过一段时间后在 web 上寻求帮助之后,这是我 pb 的更多方法。 And as I past time to find the bin, i found it on openSuse 15.4 under: /usr/lib64/ruby/gems/2.5.0/gems/compass-1.0.3/bin当我过去找垃圾箱的时候,我在 openSuse 15.4 上找到了它: /usr/lib64/ruby/gems/2.5.0/gems/compass-1.0.3/bin

For that I do before:为此,我以前做过:

find  /usr/lib64/ruby/gems/2.5.0/gems/  -type f | grep compass

then然后

PATH=$PATH:/usr/lib64/ruby/gems/2.5.0/gems/compass-1.0.3/bin
export PATH

Hope this will be usefull for anybody希望这对任何人都有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM