我最近花了很多时间试图在服务器上安装Foundation 5 SASS,但遇到了连续不断的错误。然而,我终于可以把它缩小到一个问题,thor
gem。我的服务器是通过从Digital Ocean安装的一键LEMP Ubuntu应用程序堆栈安装的。
我已经重置了10多次服务器,所有这些都是为了尝试不同的方法。以下是最近出现的一些错误。
===========================================首次尝试
*程序列表*
/usr/share/nginx$ git --version
git version 1.9.1
/usr/share/nginx$ node --version
v0.10.25
/usr/share/nginx$ ruby --version
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
/usr/share/nginx$ sudo bower --version
1.4.1
/usr/share/nginx$ gem list
** LOCAL GEMS **
bundler (1.10.3)
chunky_png (1.3.4, 1.3.3)
compass (1.0.3)
compass-core (1.0.3, 1.0.1)
compass-import-once (1.0.5)
ffi (1.9.8, 1.9.6)
foundation (1.0.4)
fssm (0.2.10)
multi_json (1.11.0, 1.10.1)
rb-fsevent (0.9.5, 0.9.4)
rb-itnotify (0.9.5)
sass (3.4.14)
thor (0.19.1)
*错误*
*************:/usr/share/nginx$ foundation new [FOLDERNAME]
Creating ./[FOLDERNAME]
create html
/usr/lib/ruby/1.9.1/fileutils.rb:247:in 'mkdir': Permission denied -/usr/share/nginx/[FOLDERNAME] (Errno::EACCES)
from /usr/lib/ruby/1.9.1/fileutils.rb:247:in 'fu_mkdir'
from /usr/lib/ruby/1.9.1/fileutils.rb:221:in 'block (2 levels) in mkdir_p'
from /usr/lib/ruby/1.9.1/fileutils.rb:219:in 'reverse_each'
from /usr/lib/ruby/1.9.1/fileutils.rb:205:in 'each'
from /usr/lib/ruby/1.9.1/fileutils.rb:205:in 'mkdir_p'
from /usr/lib/ruby/1.9.1/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:50:in 'block in invoke!'
from /var/lib/ruby/1.9.1/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb.116:in 'call'
from /var/lib/ruby/1.9.1/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in 'invoke_with_conflict_check'
from /var/lib/ruby/1.9.1/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:49:in 'invoke!'
from /var/lib/ruby/1.9.1/gems/thor-0.19.1/lib/thor/actions.rb:94:in 'action'
from /var/lib/ruby/1.9.1/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:14:in 'empty_directory'
from /var/lib/ruby/1.9.1/gems/foundation-1.0.4/lib/foundation/cli/generator.rb:126:in 'new'
from /var/lib/ruby/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27: in 'run'
from /var/lib/ruby/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in 'new'
from /var/lib/ruby/1.9.1/gems/thor-0.19.1/lib/thor.rb:359: in 'dispatch'
from /var/lib/ruby/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in 'start'
from /var/lib/ruby/1.9.1/gems/thor-0.19.1/lib/thor/foundation:4:in '<top (required)>'
from /usr/local/bin/foundation:23:in 'load'
from /usr/local/bin/foundation.23:in '<main>'
===========================================第二次尝试
(作为根(
adduser admin
usermod -a -G sudo admin
logout
(作为管理员(
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
sudo apt-get install git
sudo apt-get install ruby
sudo apt-get install nodejs
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo apt-get install npm
git --version
git version 1.9.1
ruby --version
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
node --version
v0.10.25
nodejs --version
v0.10.25
npm --version
1.3.10
sudo npm install -g bower grunt-cli
bower --version
1.4.1
gem install foundation
Fetching: thor-0.19.1.gem (100%)
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /var/lib/gems
sudo gem install foundation
sudo gem install compass
Fetching: sass-3.4.15.gem (100%)
Fetching: multi_json-1.11.1.gem (100%)
Fetching: compass-core-1.0.3.gem (100%)
Fetching: compass-import-once-1.0.5.gem (100%)
Fetching: chunky_png-1.3.4.gem (100%)
Fetching: rb-fsevent-0.9.5.gem (100%)
Fetching: ffi-1.9.10.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing compass.
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custome_require.rb:36:in 'require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custome_require.rb:36:in 'requre'
from extconf.rb:4:in '<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.10 for inspection
Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/gem_make.out
从这个时候可以看出,当我尝试安装foundation
时,gem第一次出现,并给出了Errno::EACCES
错误。然而,我用sudo
"修复"了这个问题,并能够更进一步,在那里我不得不完全停止。这似乎是我所有问题的症结所在,但我对Ruby一无所知。
可能是我使用的是一键安装吗?如果我手动安装LEMP堆栈会更好吗?此外,我应该以root身份安装所有内容,然后尝试以启用sudo的用户身份创建项目吗?
我已经在基金会论坛和Ruby论坛上发帖,但还没能得到任何东西。
基金会论坛
Ruby Forum
如果我需要包括其他内容,请告诉我!
故障似乎与用户权限有关。出于绝望,我尝试用/home/admin
创建一个新的基础项目,结果成功了!我运行了SASS设置的其余部分,然后迅速将文件夹移动到/usr/share/nginx/html
,现在一直在修复我的网站的其余部分。
显然,我在../nginx/
文件夹中没有(thor gem(所需的必要权限,但我在../admin/
文件夹中确实有这些权限。这是因为../admin/
文件夹是为我的用户创建的主目录,但nginx
文件夹是由root
创建的。为了解决这个问题,我只需要将nginx
权限更改为root sudo
,而不是root root
。
总之,问题在于权限,而不是基础安装过程。他们页面上的说明应该是正确安装产品所必需的全部内容。