node.js - 为什么 Grunt 不使用 Nodemon 启动我的 Express 服务器?

标签 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.

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

最佳答案

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

关于node.js - 为什么 Grunt 不使用 Nodemon 启动我的 Express 服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23545464/

相关文章:

javascript - Node.js 抓取 HTML 时返回 Null

node.js - 延迟处理 Node 中传入的 HTTP 请求

gruntjs - Grunt - 删除所有文件和子目录中具有特定文件扩展名的文件

node.js - 如何在 GitHub Actions/Workflows 配置中安装 imagemagick 和其他自制软件依赖项?

node.js - CMD批处理文件: How to use a text file to input commands

node.js - 在 Mailgun 和 Express js 中创建动态模板

node.js - 如何使用node.js在express.js上使用twitter api显示推文?

wordpress - 如何在 Grunt LESS 任务选项中的横幅后添加换行符

gruntjs - 从 yeoman/grunt 中删除组件/任务的正确方法?

php - 在 nodejs 和 php 之间共享 cookie