2016-02-16 95 views
1

我正在嘗試在CentOS 7上使用grunt和yeoman設置node.js服務器,但我收到一條錯誤消息,指出無法找到compass命令。我讀this other posting about a similar error,但另一篇文章假設你在軌道上使用紅寶石,我不是。另外,the methods that I am testing come from this tutorial,和事情停止工作,當我到達教程中的地方,它說,鍵入grunt serve.我已經做了幾個補充教程一個接一個地解決錯誤消息,但目前有關指南針的錯誤似乎並沒有一個谷歌的答案。grunt找不到指南針命令。爲什麼不?

我需要採取哪些特定步驟才能讓咕嚕聲能夠找到並使用指南針?

這裏,這是造成grunt serve失敗當前錯誤:

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. 

下面是一系列導致這一問題的命令:

首先,我執行了以下安裝命令爲根:

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 

接下來,我切換到非root用戶帳戶並運行以下命令:

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 

grunt serve命令導致以下完整的錯誤輸出:

[[email protected] 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 
[[email protected] client]$ 

需要注意的是,當我嘗試運行grunt serve爲根,而不是返回相同的錯誤消息。 那麼需要採取哪些具體步驟來解決這個錯誤?

回答

3

我以爲指南針是一件紅寶石的事情。

嘗試gem install compass

對於基於百勝系統

yum -y install gcc ruby-devel rubygems compass也可能會奏效。

+0

是的,我明顯已經發現,在發佈此問題之前進行我的研究。但是來自OP的鏈接中的教程來源沒有提及任何地方的ruby,所以我的假設是ruby不是必需的。另外,當我輸入'gem install compass'時,終端回覆'bash:gem:command not found ...'。我不願意在服務器上安裝ruby,因爲它是另一個依賴項,我只想安裝必要的東西。你有沒有另一種方法來解決這個問題沒有紅寶石? – CodeMed

+1

如果您查看npm羅盤包裝,步驟1是確保安裝指南針。當你按照鏈接,他們解釋這是一個寶石。 –

+0

https://www.npmjs.com/package/compass –