为什么Grunt不会用Nodemon启动我的快速服务器?

时间:2014-05-08 14:58:42

标签: node.js express gruntjs nodemon

我的Gruntfile是:

module.exports = (grunt) ->
  grunt.initConfig
    pkg: grunt.file.readJSON 'package.json'

    concurrent:
      tasks: [
        'nodemon'
      ]

    nodemon:
     dev:
        options:
          script: "server.coffee"
          args: []
          ignoredFiles: ["public/**"]
          watchedExtensions: ["coffee"]
          nodeArgs: ["--debug"]
          delayTime: 1
          env:
            PORT: 9001

          cwd: __dirname

  require('load-grunt-tasks')(grunt)

  grunt.registerTask 'start', 'concurrent'

我的server.coffee也非常简单:

'use strict'

express = require 'express'
winston = require 'winston'

config = require('environmental-configuration')('./config')

app = express()

app.listen config.port
winston.info "App started on port #{config.port}"

module.exports = app

但当我grunt start时,我得到:

Running "concurrent:tasks" (concurrent) task

    Running "nodemon:dev" (nodemon) task

Done, without errors.

那么我错误的是服务器无法启动?

1 个答案:

答案 0 :(得分:1)

我认为grunt不知道调用nodemon中配置的脚本,也许看看Running a command in a Grunt Task