gpt4 book ai didi

ruby - compass 安装在 WebSpace : Command not found

转载 作者:太空宇宙 更新时间:2023-11-04 10:44:16 29 4
gpt4 key购买 nike

我想在托管服务器上的我的网站空间中使用 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

安装 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

检查安装

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

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

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

编辑:更多信息

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

关于ruby - compass 安装在 WebSpace : Command not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33798904/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com