我最近花了很多时间尝试在我的服务器上安装Foundation 5 SASS,但是遇到了一连串的错误。但是,我终于明白我可以将它缩小到一个问题,即thor
宝石。我的服务器安装了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>'
=========================================== 第二次尝试
(AS ROOT)
adduser admin
usermod -a -G sudo admin
logout
(AS ADMIN)
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
时,宝石首先爆发,并发出Errno::EACCES
错误。但是,我用sudo
“修复”了这个问题,并且能够更进一步,我完全不得不停下来。它似乎是导致我所有问题的Thor gem,但我根本不了解Ruby。
可能是因为我使用一键安装吗?如果我手动安装LEMP堆栈会更好吗?另外,我应该以root身份安装所有内容,然后尝试将项目创建为启用了sudo的用户吗?
我已经发布到基金会论坛和Ruby论坛,但还没有得到任何东西。
如果我需要包含其他内容,请告诉我们。
答案 0 :(得分:0)
故障似乎以某种方式存在于用户权限中。出于绝望,我试图从/home/admin
创建一个新的基础项目,它有效!我运行了SASS设置的其余部分,然后立即将文件夹移动到/usr/share/nginx/html
,并且一直在努力修复我的网站的其余部分。
显然,我在../nginx/
文件夹中没有必要的权限(对于thor gem),但我确实在../admin/
文件夹中有这些权限。这是因为../admin/
文件夹是作为我的用户的主目录创建的文件夹,但nginx
文件夹是由root
创建的。要解决此问题,我只需将nginx
权限更改为root sudo
,而不是root root
。
无论如何,总而言之,问题在于基金会安装过程中的权限,不是。其页面上的说明应该是正确安装产品所需的全部内容。