首页 文章

如何调试meanjs,node-inspector没有打开debug?port = 5858

提问于
浏览
2

我克隆了meanjs并在启动时使用npm install和grunt运行它显示调试器在端口5858上侦听,但是当我打开chrome时

本地主机:8080 /调试端口= 5858

它显示网页不可用 . 有什么我需要做的让node-inspector调试器为meanjs工作?

2 回答

  • 0

    好吧,如果你按照我的假设使用Yeoman Generator(meanjs.org)中的Gruntfile,只需在你的控制台中运行 grunt debug 而不是简单的 grunt . 如果您具有以下默认设置,那么节点检查器将在 http://localhost:1337/debug?port=5858 处可用:

    watch: {
      serverViews: {
        files: watchFiles.serverViews,
        options: {
          livereload: true
        }
      },
      serverJS: {
        files: watchFiles.serverJS,
        tasks: ['jshint'],
        options: {
          livereload: true
        }
      },
      clientViews: {
        files: watchFiles.clientViews,
        options: {
          livereload: true,
        }
      },
      clientJS: {
        files: watchFiles.clientJS,
        tasks: ['jshint'],
        options: {
          livereload: true
        }
      },
      clientCSS: {
        files: watchFiles.clientCSS,
        tasks: ['csslint'],
        options: {
          livereload: true
        }
      }
    },
    nodemon: {
      dev: {
        script: 'server.js',
        options: {
          nodeArgs: ['--debug'],
          ext: 'js,html',
          watch: watchFiles.serverViews.concat(watchFiles.serverJS)
        }
      }
    },
    'node-inspector': {
      custom: {
        options: {
          'web-port': 1337,
          'web-host': 'localhost',
          'debug-port': 5858,
          'save-live-edit': true,
          'no-preload': true,
          'stack-trace-limit': 50,
          'hidden': []
        }
      }
    },
    concurrent: {
      default: ['nodemon', 'watch'],
      debug: ['nodemon', 'watch', 'node-inspector'],
      options: {
        logConcurrentOutput: true,
        limit: 10
      }
    }
    

    主要的cli任务在gruntfile的底部定义:

    // Default task(s).
    grunt.registerTask('default', ['lint', 'concurrent:default']);
    
    // Debug task.
    grunt.registerTask('debug', ['lint', 'concurrent:debug']);
    
  • 9

    您需要启动节点检查器服务器,该服务器将在8080上侦听:

    node-inspector

    然后您就可以点击调试URL了

相关问题