2

Three ways to activate an inspector in Node.js

 1 year ago
source link: https://pawelgrzybek.com/three-ways-to-activate-an-inspector-in-node-js/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Three ways to activate an inspector in Node.js

Three ways to activate an inspector in Node.js

Published: 2023.03.03 · 1 minute read

There are multiple methods to activate the Node.js inspector. I used to use two ways but recently learned about a third one, so I published this quick post to share it with you. Have a look!

node --inspect index.mjs
node --inspect-brk index.mjs
NODE_OPTIONS='--inspect' node index.mjs

Activating an inspector using a NODE_OPTIONS environment variable is handy for debugging a process that runs node indirectly.

NODE_OPTIONS='--inspect' gatsby serve
NODE_OPTIONS='--inspect' next dev
NODE_OPTIONS='--inspect' jest

If you are new to Node.js debugger, I published two articles in the past that you may find helpful — “Basic Node.js debugging in Google Chrome” and “Continue, Step Over, Step Into and Step Out actions in Visual Studio Code debugger explained”. I hope that helps!

Did you like it? Please share it with your friends or get me a beer coffee. Thanks!

Leave a comment#

Name:
Website (optional):
GitHub (optional):
Comment:

👆 you can use Markdown here

Save my data for the next time I comment

© 2023 Copyright Pawel Grzybek. All rights reserved.
This site is built with Hugo and hosted on Netlify . The source code is hosted on GitHub.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK