rel 0.4.8 Object #<Object> has no method 'async' on exit #30

Closed
RBLU opened this Issue Dec 5, 2013 · 7 comments

Comments

Projects
None yet
3 participants

RBLU commented Dec 5, 2013

When I update my build to the newest 0.4.8 I get the following error when grunt is exiting and the server should be stopped.

When I fix the dependency to 0.4.7 it works again.

TypeError: Object #<Object> has no method 'async'
    at process.stop (/Users/retoblunschi/Documents/workspace/yp-backend/node_modules/grunt-express-server/tasks/lib/server.js:111:39)
    at process.EventEmitter.emit (events.js:117:20)
    at process.exit (node.js:707:17)
    at tryToExit (/Users/retoblunschi/Documents/workspace/yp-backend/node_modules/grunt/node_modules/exit/lib/exit.js:17:15)
    at Object.exit (/Users/retoblunschi/Documents/workspace/yp-backend/node_modules/grunt/node_modules/exit/lib/exit.js:34:3)
    at Object.task.options.done (/Users/retoblunschi/Documents/workspace/yp-backend/node_modules/grunt/lib/grunt.js:147:14)
    at Task.<anonymous> (/Users/retoblunschi/Documents/workspace/yp-backend/node_modules/grunt/lib/util/task.js:261:25)
    at Task.<anonymous> (/Users/retoblunschi/Documents/workspace/yp-backend/node_modules/grunt/lib/util/task.js:215:7)
    at null._onTimeout (/Users/retoblunschi/Documents/workspace/yp-backend/node_modules/grunt/lib/util/task.js:225:33)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

thanks,
Reto

Owner

ericclemmons commented Dec 5, 2013

Can you let me know what what grunt task(s) you're running & what your express block looks like? I need to be able to reproduce this...

RBLU commented Dec 5, 2013

sure:
I am running this task:
grunt.registerTask('test', ['jshint', 'express:dev', 'jasmine_node']);
the relevant grunt config blocks:

jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            gruntfile: {
                src: ['Gruntfile.js']
            },
            code: {
                src: ['app.js', 'config/**/*.js', 'models/**/*.js', 'routes/**/*.js']
            }
        },
express: {
            options: {
                // Override defaults here
            },
            dev: {
                options: {
                    script: './app.js',
                    delay: 5000,
                    output: null  // is needed, otherwise delay is ignored after any server output to System.out

                }
            },
 jasmine_node: {
            specNameMatcher: "spec", // load only specs containing specNameMatcher
            projectRoot: ".",
            requirejs: false,
            autotest: true,
            forceExit: true,
            jUnit: {
                report: true,
                savePath: "./build/reports/jasmine/",
                useDotNotation: true,
                consolidate: true
            }
        }

my current dependency versions:

"devDependencies": {
    "grunt-contrib-jshint": "~0.6.x",
    "grunt-jasmine-node": "0.1.x",
    "grunt": "0.4.x",
    "grunt-express-server": "0.4.7"
  },

with this it works, when I put "0.4.x" for grunt-express-server, I get the error above

Owner

ericclemmons commented Dec 5, 2013

Reverted v0.4.8 & just published v0.4.9 until this is resolved. Sorry about that :(

Owner

ericclemmons commented Dec 5, 2013

(Can you confirm v0.4.9 works for you? That way I can go back to the original problem)

RBLU commented Dec 5, 2013

confirmed: v0.4.9 is running fine here
thanks

Owner

ericclemmons commented Dec 5, 2013

Good deal! Back to resolving the other issue now :)

Contributor

sebgie commented Dec 6, 2013

I can reproduce that problem, it appears when the express server isn't stopped in gruntfile.js. The 'exit' event will call stop, but has no access to the current grunt task anymore.

@sebgie sebgie added a commit to sebgie/grunt-express-server that referenced this issue Dec 6, 2013

@sebgie sebgie Fix multiple instances and no method 'async' bug
closes #28
closes #30
- added stopdone to wait for server to stop
- renamed done to startdone
- added conditional for `grunt.task.current.async()`
- added testsequence which is able to reproduce the bug without my
changes to server.js
- added `express:defaults` without `express:defaults:stop` at the end
of the file to reproduce missing 'async'
997637b

@eluck eluck pushed a commit to eluck/grunt-express-server that referenced this issue Dec 15, 2013

eluck fix issue #30 88c7239
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment