【nodejs】调试

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wuzh1230/article/details/79286874

use v8.9.3 instead of v0.10.x version of nodejs

compile a debuggee

var hell = 'world';
console.log(hello.length); // undefined error

startup debuggee witho nodejs

$node --inspect-brk=0.0.0.0:12345 debuggee.js
Debugger listening on ws://192.168.56.101:12345/fcf48731-9cb2-4172-b5a6-4f63f0798661
For help see https://nodejs.org/en/docs/inspector

read json configuration from url

Paste this url into chrome

http://192.168.56.101/json

[ {
  "description": "node.js instance",
  "devtoolsFrontendUrl": "chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=192.168.56.101:12345/fcf48731-9cb2-4172-b5a6-4f63f0798661",
  "faviconUrl": "https://nodejs.org/static/favicon.ico",
  "id": "fcf48731-9cb2-4172-b5a6-4f63f0798661",
  "title": "test.js",
  "type": "node",
  "url": "file:///home/harry/workspace/bitbaba/www/test.js",
  "webSocketDebuggerUrl": "ws://192.168.56.101:12345/fcf48731-9cb2-4172-b5a6-4f63f0798661"
} ]

start to debug by pasting debugging url

Paste this url into chrome to startup debugging:

chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=192.168.56.101:12345/fcf48731-9cb2-4172-b5a6-4f63f0798661

猜你喜欢

转载自blog.csdn.net/wuzh1230/article/details/79286874