我克隆了meanjs并使用npm install和grunt运行在启动时,它显示调试器监听端口5858,但是当我用
打开chromelocalhost: 8080/调试吗?端口= 5858
显示网页不可用。是否有什么我需要做的,使节点检查器调试器为meanjs工作?
好吧,如果您使用的是来自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']);
您需要启动节点检查器服务器,该服务器将侦听8080:
然后你就可以点击调试URLnode-inspector