3

私は非常に単純なうなり声のセットアップをしています。アクティブなプラグインは grunt-contrib-connect のみです。ここに私のpackage.jsonファイルがあります:

{
  "name": "gruntApp",
  "version": "0.1.0",
  "description": "An application for testing Grunt.js",
  "devDependencies": {
    "grunt": "~0.4.1",
    "grunt-contrib-connect": "~0.3.0"
  }
}

私のグラントファイルは次のようになります。

module.exports = (grunt) ->
  grunt.initConfig
    pkg: grunt.file.readJSON 'package.json'
    log:
      start: 'Grunt is starting for application <%=pkg.name%> v<%=pkg.version%>'
      end: 'Grunt is finishing'
  grunt.registerMultiTask 'log', ->
    grunt.log.writeln this.data
  grunt.registerTask 'printConfig', ->
    grunt.log.writeln JSON.stringify grunt.config(), null, 2
  grunt.loadNpmTasks 'grunt-contrib-connect'
  grunt.registerTask 'default', [
    'log:start'
    'log:end'
  ]

カスタム タスクは機能しますが、grunt connect機能しません。コンソールでの出力は次のとおりです。

$ grunt connect -v

Initializing
Command-line options: --verbose

Reading "Gruntfile.coffee" Gruntfile...OK

Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK

Registering "grunt-contrib-connect" local Npm module tasks.
Reading /Users/eric/Projects/gruntApp/node_modules/grunt-contrib-connect/package.json...OK
Parsing /Users/eric/Projects/gruntApp/node_modules/grunt-contrib-connect/package.json...OK
Loading "connect.js" tasks...OK
+ connect
Loading "Gruntfile.coffee" tasks...OK
+ default, log, printConfig

Running tasks: connect

Running "connect" task
>> No "connect" targets found.
Warning: Task "connect" failed. Use --force to continue.

Aborted due to warnings.

どうしたの、よ?接続タスクを検出したように見えますが、後でターゲットを見つけることができません。私は何が欠けていますか?ここからの指示に従っていました: https://github.com/gruntjs/grunt-contrib-connect#getting-started

4

1 に答える 1