1

I'd like to start a Nodejs debugger for my Hexo blog to understand how my theme works and possibly find a bug.

1 Answer 1

3

I needed 2 things to achieve this:

  1. Install hexo-cli as a dev dependency rather than global. I used npm i hexo-cli --save-dev.
  2. In package.json, under scripts, add a script called debug. I used this command: node --inspect=4300 ./node_modules/hexo-cli/bin/hexo server.

Then just use npm run debug and you're good to connect with a debugger to port 4300 (or whatever port you want to set in your command) and do line-to-line debugging etc.

One caveat is that with the --inspect setting, for some reason hexo is starting extremely slow (takes more than 2 minutes). I wonder what causes this.

Also, I haven't found a way to start hexo in a way that it generates pages dynamically. It would help with real time debugging.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.