搭建Node.js调试环境,调试Hexo

首先需要在GitHub上下载Hexo的源代码,然后安装:

1
2
3
hexo init
npm install hexo
npm install -g

安装调试程序:

1
npm install -g node-inspector

输入 node-inspector 启动调试工具,然后1

1
node --debug-brk=5858 node_modules/.bin/hexo generate

调试工具会监听5858端口。然后打开一个新的终端,输入2

1
node-inspector

打开Chrome输入http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858,脚本现在就已经断点在了第一行3


  1. http://stackoverflow.com/questions/30942953/how-can-i-debug-a-node-app-that-is-started-via-the-command-line-cli-like-forev↩︎

  2. http://blog.domlib.com/articles/686.html↩︎

  3. http://xzper.com/2014/08/17/浅析Hexo的Generate命令/↩︎