- Install JDK and Eclipse IDE on your Windows PC. If you do not know how to do it, please read the article Beginner’s Guide For Install JDK(Java Development Kit) And Eclipse In Windows.
- Now you can see test.js in the left project explorer.
3. Setup Debug Runtime Configuration.
- Click Eclipse toolbar Window —> Preferences menu.
- Click Add button to add Node.js runtime environment. This needs you first install node.js on your PC. You can read the article How To Install Node JS In Windows to learn more. I recommend you install node.js windows binary edition which is unzipped from a zip file.
- I recommend you use node version 7.10.1 because it is a more stable version, if you use version 8 or 9 when you start debugging, it may through the below error message.
(node:10012) [DEP0062] DeprecationWarning: `node –debug` and `node –debug-brk` are invalid. Please use `node –inspect` or `node –inspect-brk` instead.Failed to connect to Standalone V8 VM
- Right-click the js file in the left panel, choose Debug As —> Debug Configurations menu. It will popup a dialog that lets you configure debug parameters.
I just test the above procedure with Eclipse Neon.3 Release ( 4.6.3 ) and node version 7.10.1. These two components are stable to use.
If you use Node.js version 8 or 9, then you may encounter debug start failed error with the below error message.
(node:10012) [DEP0062] DeprecationWarning: `node --debug` and `node --debug-brk` are invalid. Please use `node --inspect` or `node --inspect-brk` instead. Failed to connect to Standalone V8 VM
To fix this error, you can refer to the comments https://www.dev2qa.com/how-to-run-debug-node-js-application-with-eclipse/#comment-95159