Search code examples
rubysasszurb-foundation-5thor

Foundation 5 SASS Install - Thor gem crashes


I have recently spent a LOT of time attempting to install Foundation 5 SASS on my server, but have run into a continual stream of errors. However, I have finally gotten to the point that I can narrow it down to one issue, the thor gem. My server was installed with the 1-click LEMP Ubuntu application stack install from Digital Ocean.

I have reset my server over 10 times, all to try different approaches. Here are some of the most recent, with the different errors that appear.

=========================================== FIRST ATTEMPT

* PROGRAM LIST *

/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)

* ERROR *

*************:/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>'

=========================================== SECOND ATTEMPT

(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

As you can see from this time, the gem first flared up when I tried to install foundation, and gave the Errno::EACCES error. However, I "fixed" this with sudo, and was able to get one step further, where I completely had to stop. It seems to be the thor gem that is causing all of my issues, but I don't know anything about Ruby at all.

Could it possibly be the fact that I am using the 1-click install? Would it be better if I manually installed the LEMP stack? Also, should I install everything as root, and then try to create the Project as the sudo-enabled user?

I have posted to both the Foundation forum and the Ruby forum, but haven't been able to get anything yet.

Foundation Forum

Ruby Forum

Please let me know if I need to include anything else!


Solution

  • The fault appears to somehow lie with user permissions. Out of desperation, I attempted to create a new foundation project from /home/admin, and it worked! I ran the rest of the SASS setup, and then promptly moved the folder to /usr/share/nginx/html, and have been working on fixing the rest of my site now.

    Apparently, I do not have the necessary permissions in the ../nginx/ folder that I need (for the thor gem), but yet I do have them in the ../admin/ folder. This is because the ../admin/ folder is the one created as the home directory for my user, but the nginx folder was created by root. To fix this, I merely had to change the nginx permissions to root sudo, instead of root root.

    Anyway, to sum it up, the problem lay with permissions, not with the Foundation installation process. The instructions on their page should be all that are necessary to correctly install the product.