grunt 找不到罗盘命令。为什么不?
grunt cannot find compass command. Why not?
我正在尝试使用 grunt 和 yeoman 在 CentOS 7 上设置一个 node.js 服务器,但我收到一条错误消息,提示无法找到 compass
命令。我读了 , 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,当我读到教程中说要输入 grunt serve.
的地方时,一切都停止了。关于指南针的错误似乎没有 google 可用的答案。
我需要采取哪些具体步骤才能让 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.
这是导致此问题的一系列命令:
首先,我以 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
接下来,我切换到非根用户帐户并运行执行以下命令:
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
命令导致以下完整错误输出:
[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]$
请注意,当我以 root 身份尝试 运行 grunt serve
时,会返回相同的错误消息。 那么需要采取哪些具体步骤来解决这个错误?
我以为罗盘是 ruby 东西。
尝试gem install compass
对于基于 yum 的系统
yum -y install gcc ruby-devel rubygems compass
也可能有效。
我正在尝试使用 grunt 和 yeoman 在 CentOS 7 上设置一个 node.js 服务器,但我收到一条错误消息,提示无法找到 compass
命令。我读了 grunt serve.
的地方时,一切都停止了。关于指南针的错误似乎没有 google 可用的答案。
我需要采取哪些具体步骤才能让 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.
这是导致此问题的一系列命令:
首先,我以 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
接下来,我切换到非根用户帐户并运行执行以下命令:
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
命令导致以下完整错误输出:
[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]$
请注意,当我以 root 身份尝试 运行 grunt serve
时,会返回相同的错误消息。 那么需要采取哪些具体步骤来解决这个错误?
我以为罗盘是 ruby 东西。
尝试gem install compass
对于基于 yum 的系统
yum -y install gcc ruby-devel rubygems compass
也可能有效。