ChrisWren / grunt-nodemon

Grunt task to run nodemon
MIT License
345 stars 37 forks source link

no error in grunt, but server doesnt run #40

Closed Devric closed 10 years ago

Devric commented 10 years ago

I'm testing this task with grunt nodemon -v

the output for nodemon

Running "nodemon:script" (nodemon) task
Verifying property nodemon.script exists in config...OK
Files: app.js -> script
Options: (none)

but the server doesn't come up, it just go back to bash, it works normally if i just run nodemon not from grunt.

i've tried different Gruntfile configs, starting from the minimal config from sample

nodemon: {
  dev: {
    script: 'index.js'
  }
}
ChrisWren commented 10 years ago

Can you show me the exact Gruntfile.js and terminal output after running grunt nodemon?

Devric commented 10 years ago

app.js is the express server file, port 3000

minimal gruntfile just to test

/*global module:false*/
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    concurrent : {
        run : ['nodemon', 'watch']
    }
  , nodemon : {
        script : 'app.js'
    }
  , watch: {
      options : {
        livereload : true
      }
    , sciprts : {
        files : ['routes/**/*.js']
      }
    , css : {
        files : 'public/stylesheets/**/*.css'
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-concurrent');
  grunt.loadNpmTasks('grunt-nodemon');

  // Default task.
  grunt.registerTask('default', ['concurrent:run']);

};

terminal output

(~ O_o)> grunt nodemon -v
Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Initializing config...OK

Registering "grunt-contrib-watch" local Npm module tasks.
Reading /Users/Devric/Sites/test/grunthub/a/node_modules/grunt-contrib-watch/package.json...OK
Parsing /Users/Devric/Sites/test/grunthub/a/node_modules/grunt-contrib-watch/package.json...OK
Loading "watch.js" tasks...OK
+ watch

Registering "grunt-concurrent" local Npm module tasks.
Reading /Users/Devric/Sites/test/grunthub/a/node_modules/grunt-concurrent/package.json...OK
Parsing /Users/Devric/Sites/test/grunthub/a/node_modules/grunt-concurrent/package.json...OK
Loading "concurrent.js" tasks...OK
+ concurrent

Registering "grunt-nodemon" local Npm module tasks.
Reading /Users/Devric/Sites/test/grunthub/a/node_modules/grunt-nodemon/package.json...OK
Parsing /Users/Devric/Sites/test/grunthub/a/node_modules/grunt-nodemon/package.json...OK
Loading "nodemon.js" tasks...OK
+ nodemon
Loading "Gruntfile.js" tasks...OK
+ default

Running tasks: nodemon

Running "nodemon" task

Running "nodemon:script" (nodemon) task
Verifying property nodemon.script exists in config...OK
Files: app.js -> script
Options: (none)
ChrisWren commented 10 years ago

ah, so you need to change your nodemon config to have a target (such as dev) like so:

nodemon: {
  dev: {
    script: 'app.js'
  }
}

it is currently treating script as a files object as seen with this output:

Files: app.js -> script

You should then be able to run grunt nodemon:dev. Let me know if this works.

Devric commented 10 years ago

hm, its working! :+1: