【问题标题】:Why won't Grunt start my express server with Nodemon?为什么 Grunt 不能用 Nodemon 启动我的 express 服务器?
【发布时间】:2014-06-26 01:31:14
【问题描述】:

我的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.

那么我做错了什么导致服务器无法启动?

【问题讨论】:

    标签: node.js express gruntjs nodemon


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2014-05-27
      • 1970-01-01
      • 2021-08-28
      • 1970-01-01
      • 2019-09-18
      • 1970-01-01
      • 1970-01-01
      • 2018-10-13
      • 2020-07-11
      相关资源
      最近更新 更多