1. Install Nodeclipse Eclipse Plugin.
Before you can create node js application in eclipse, you should download and install Nodeclipse plugin in your Eclipse. Eclipse version is eclipse-jee-neon-3-win32-x86_64. Nodeclipse plugin version is 1.0.2.
- Open Eclipse, click Help —> Eclipse Marketplace menu in top toolbar.
- Input nodeclipse in the popup window search text box, click Go button to search. When find the nodeclipse plugin in below picture click Install button at it’s end.
- Check all nodeclipse features in the next dialog and click Confirm button.
- Check accept license agreement in next dialog.
- Click Finish button to complete the nodeclipse plugin installation.
2. Create Node Project.
Now you can create node project follow below steps.
- Eclipse File —> New —> Project menu. Input node in Wizards search box, then select Node.js Project.
- In next dialog, input the project name and select default workspace. Select Hello World radio button in Template to use section.
- Click Finish button to complete the node.js project creation. Then you can see the wizard added files in left project panel. Click hello-world-server.js file in the file list, it is just implement a simple http web server.
3. Debug Node JS Project.
Double click the first column in hello-world-server.js file in line 3, then it will set a breakpoint at there.
Right click the js file, click Debug As —> Node.js Application menu in popup menu list. Then the debug process will start. If you meet below error.
Failed to connect to Standalone V8 VM
connect timed out
That is because you use node.js version 8 or 9 as node runtime. Those two versions are not stable, so you need follow below steps to fix above error.
- Download and install node.js version 7.10.1, please read article How To Install Node JS In Windows for detail.
- Change node app runtime by click Window —> Preferences menu in top tool bar.
- Click Finish button to complete the settings and return to node runtime list dialog. Check the checkbox before the created runtime and click OK.
- Now you can right click the js file, click Debug As —> Node.js Application menu in popup menu list. You will find the execution stopped at the first line of the js file. Then you can click debug button at top tool bar to debug the js files.