Mac 上的 Grunt 服务问题

Grunt Serve issues on Mac

步骤: npm install -g 哟

npm 安装-g grunt

npm 安装-g bower

npm install -g generator-angular

mkdir 店面

cd 店面/

哟angular

发球


grunt serve 不适合我,如下所示:

ME$ 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: Couldn't find the `compass` binary. Make sure it's installed and in your $PATH Use --force to continue.

    Aborted due to warnings.


    Execution Time (2015-04-08 20:14:01 UTC)
    loading tasks    5ms  ▇▇▇▇▇▇▇▇▇▇ 21%
    compass:server  18ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 75%
    Total 24ms Use --force to continue.

        Aborted due to warnings.


Execution Time (2015-04-08 20:13:58 UTC)
wiredep:app        115ms  ▇▇▇▇ 4%
concurrent:server   2.6s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 95%
Total 2.8s

我尝试了两件事:

  1. sudo npm install -g grunt-cli

导致:

$ sudo npm install -g grunt-cli
Password:
/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
npm WARN unmet dependency /usr/local/lib/node_modules/browserify/node_modules/module-deps/node_modules/through2 requires readable-stream@'~1.0.17' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/browserify/node_modules/readable-stream,
npm WARN unmet dependency which is version 1.0.27-1
npm WARN unmet dependency /usr/local/lib/node_modules/meteorite/node_modules/prompt/node_modules/winston requires colors@'0.x.x' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/meteorite/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/phonegap-build requires colors@'0.6.x' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/connect-phonegap/node_modules/connect/node_modules/multiparty/node_modules/stream-counter requires readable-stream@'~1.1.8' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/connect-phonegap/node_modules/connect/node_modules/multiparty/node_modules/readable-stream,
npm WARN unmet dependency which is version 1.1.13-1
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/prompt/node_modules/winston requires colors@'0.x.x' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
grunt-cli@0.1.13 /usr/local/lib/node_modules/grunt-cli
├── resolve@0.3.1
├── nopt@1.0.10 (abbrev@1.0.5)
└── findup-sync@0.1.3 (lodash@2.4.1, glob@3.2.11)

  1. npm install -g compass

导致:

ME$ npm install -g compass
npm WARN unmet dependency /usr/local/lib/node_modules/browserify/node_modules/module-deps/node_modules/through2 requires readable-stream@'~1.0.17' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/browserify/node_modules/readable-stream,
npm WARN unmet dependency which is version 1.0.27-1
npm WARN unmet dependency /usr/local/lib/node_modules/meteorite/node_modules/prompt/node_modules/winston requires colors@'0.x.x' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/meteorite/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/phonegap-build requires colors@'0.6.x' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/connect-phonegap/node_modules/connect/node_modules/multiparty/node_modules/stream-counter requires readable-stream@'~1.1.8' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/connect-phonegap/node_modules/connect/node_modules/multiparty/node_modules/readable-stream,
npm WARN unmet dependency which is version 1.1.13-1
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/prompt/node_modules/winston requires colors@'0.x.x' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
compass@0.1.1 /usr/local/lib/node_modules/compass

怎么了?

我遇到了同样的问题。我通过在我的 Gruntfile 中将 logConcurrentOutput 设置为 false 来修复它。

转到应用 --> Gruntfile.js

搜索并发,并确保 logConcurrentOutput 的并发代码如下所示:

 concurrent: {
  ionic: {
    tasks: [],
    options: {
      logConcurrentOutput: false
    }
  }