1

I am trying to set up a node.js server on CentOS 7 using grunt and yeoman, but I am getting an error saying that the compass command cannot be found. I read this other posting about a similar error, but the other posting assumes you are using ruby on rails, which I am not. Also, the methods that I am testing come from this tutorial, and things stop working when I get to the point in the tutorial where it says to type grunt serve. I have made several additions to the tutorial to address error messages one by one, but the current error about compass does not seem to have a google-able answer.

What specific steps do I need to take to get grunt to be able to find and use compass?

Here is the current error which is causing grunt serve to fail:

Warning: Running "compass:server" (compass) task
Warning: Command failed: /bin/sh -c compass --version
/bin/sh: compass: command not found
 Use --force to continue.
Aborted due to warnings.

Here is the series of commands leading up to this problem:

First, I performed the following installation commands as root:

yum install -y nodejs
yum clean all && yum update
yum install -y gcc-c++ openssl-devel make
npm install -g express
npm install -g express-generator
npm install -g yo
npm install -g generator-angular
npm install -g bower
npm install -g nodemon
npm install -g grunt-cli  
npm install generator-karma 
npm install -g compass 
npm install -g grunt-contrib-compass  

Next, I switched to a non-root user account and ran the following commands:

cd /home/user/angular_apps 
mkdir /home/user/angular_apps/my_new_project && cd /home/user/angular_apps/my_new_project
mkdir /home/user/angular_apps/my_new_project/client  // will house angular and app code
mkdir /home/user/angular_apps/my_new_project/server  // will house node and express code, among other things
cd /home/user/angular_apps/my_new_project/client
yo angular  // get yeoman to scaffold out the front end
    // yeoman asked many questions.  I said no to replacing grunt with anything else and I said yes to every other include  
npm install // this will install all the required packages
bower install // this will hook up bower and thus prevent a downstream error
grunt serve 

The grunt serve command results in the following complete error output:

[user@localhost client]$ grunt serve
Running "serve" task
Running "clean:server" (clean) task
>> 0 paths cleaned.
Running "wiredep:app" (wiredep) task
Running "wiredep:test" (wiredep) task
Running "wiredep:sass" (wiredep) task
Running "concurrent:server" (concurrent) task
    Warning: Running "compass:server" (compass) task
    Warning: Command failed: /bin/sh -c compass --version
    /bin/sh: compass: command not found
     Use --force to continue.
    Aborted due to warnings.

    Execution Time (2016-02-15 23:22:25 UTC)
    loading tasks                  254ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 76%
    loading grunt-contrib-compass   28ms  ▇▇▇ 8%
    compass:server                  50ms  ▇▇▇▇▇ 15%
    Total 333ms Use --force to continue.

    Aborted due to warnings.

Execution Time (2016-02-15 23:22:24 UTC)
loading tasks             307ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 20%
wiredep:app               254ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 17%
wiredep:sass               37ms  ▇▇▇ 2%
loading grunt-concurrent   23ms  ▇▇ 2%
concurrent:server         865ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 57%
Total 1.5s
[user@localhost client]$ 

Note that the same error message is returned when I try running grunt serve as root instead. So what specific steps need to be taken to resolve this error?

Community
  • 1
  • 1
CodeMed
  • 9,527
  • 70
  • 212
  • 364

1 Answers1

3

I thought compass was a ruby thing.

try gem install compass

For yum based systems

yum -y install gcc ruby-devel rubygems compass might also work.

j_mcnally
  • 6,928
  • 2
  • 31
  • 46
  • Yes, I obviously already found that while doing my research before posting this question. But the tutorial source in the link from the OP makes no reference of ruby anywhere, so my assumption is that ruby is not necessary. Also, when I type `gem install compass`, the terminal replies with `bash: gem: command not found...`. I hesitate to install ruby on the server because it is yet another dependency and I only want to install things that are necessary. Do you have another approach to solve this problem without ruby? – CodeMed Feb 16 '16 at 00:10
  • 1
    If you look up the npm compass wrapper, step 1 is to make sure compass is installed. When you follow the link they explain it is a gem. – j_mcnally Feb 16 '16 at 00:12
  • What OS do you use? I am on CentOS 7 and I want to avoid the hell of using the wrong approach to installing software. – CodeMed Feb 16 '16 at 00:18
  • Also, do I need rails for this or just ruby? – CodeMed Feb 16 '16 at 00:21
  • just ruby, you can install via yum. http://business-it-consultant.co.uk/blog/install-compass-centos-64 – j_mcnally Feb 16 '16 at 17:31
  • Yes, but future readers here need to find the syntax in the comment, which is `yum -y install gcc ruby-devel rubygems compass` to avoid header errors.` Also note that, while yum is best for letting the linux distro manage the plumbing, the yum version of ruby now is 2.0, while the stable release from ruby is 2.x++. Thank you and +1 for this all. – CodeMed Feb 16 '16 at 19:09