Using node-inspector with Grunt tasks

后端 未结 7 1898
悲哀的现实
悲哀的现实 2020-12-04 06:20

Does someone used node-inspector with Grunt for application debugging? If not, Can you recommend a debugging tool for Grunt based apps?

I\'m working with nodejs for

相关标签:
7条回答
  • 2020-12-04 06:51

    I have done a task to run my app and launch node-inspector. It is far better than current proposition, you just have to add this task in gruntfile:

      grunt.registerTask('debug', 'My debug task.', function() {
            var done = this.async();
            grunt.util.spawn({
                cmd: 'node',
                args: ['--debug', 'app.js'],
                opts: {
                    //cwd: current workin directory
                }
            },
            function (error, result, code) {
                if (error) {
                    grunt.log.write (result);
                    grunt.fail.fatal(error);
                }
                done();
            });
            grunt.log.writeln ('node started');
            grunt.util.spawn({
                cmd: 'node-inspector',
                args: ['&'],
                opts: {
                    //cwd: current workin directory
                }
            },
            function (error, result, code) {
                if (error) {
                    grunt.log.write (result);
                    grunt.fail.fatal(error);
                }
                done();
            });
            grunt.log.writeln ('inspector started');
        });
    
    0 讨论(0)
提交回复
热议问题