This article will show you examples of how to use the Nodeclipse plugin to create and debug node js applications in eclipse.
1. Install Eclipse Node JS Plugin Nodeclipse.
Before you can create a Node.js application in eclipse, you should download and install the 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 the top toolbar.
- Input the keyword nodeclipse in the popup window search text box, click the Go button to search. When finding the nodeclipse plugin, click the Install button at its end to install it.
- Check all nodeclipse features in the next dialog and click Confirm button.
- Select the accept license agreement radio button in the next dialog.
- Click the Finish button to complete the nodeclipse plugin installation.
2. Create Eclipse Node JS Project.
Now you can use eclipse to create a Node.js project follow the below steps.
- Click the eclipse File —> New —> Project menu item. Input the keyword node in Wizards search box, then selects Node.js Project.
- In the next dialog, input the project name and select the default workspace. Select the Hello World radio button in Template to use section.
- Click the Finish button to complete the eclipse node js project creation. Then you can see the wizard added files in the left project panel. Click the hello-world-server.js file in the file list, it just implements a simple HTTP web server.
3. Debug Eclipse Node JS Project.
- Double click the first column in the hello-world-server.js file in line 3, then it will set a breakpoint there.
- Right-click the js file, click Debug As —> Node.js Application menu in the popup menu list. Then the debug process will start. If you meet the 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 to follow the below steps to fix the above error.
- Download and install Node.js version 7.10.1, please read the article How To Install Node JS In Windows for detail.
- Change node app runtime by click eclipse Window —> Preferences menu in the top toolbar.
- Select the node.exe file in the Location input box, give the runtime a name in the Name input box.
- Click the Finish button to complete the settings and return to the 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 the popup menu list. You will find the execution stopped at the first line of the js file. Then you can click debug button at the top toolbar to debug the js files.
1 thought on “Node JS Hello World Example With Eclipse”
I want to use eclipse to create a node js project. And I also want to use the express module in the eclipse node js project.
So I install the Node.js in my Windows OS and install the Node.js express library with the command npm install express, because when I add the -g parameter to install the express library npm install -g express, it failed to install the express library.
I can run node command in widnows dos window successfully. And I write a node js script which implements a single HTTP web server like this article. When I save the node js script file in node installed folder, it can be executed successfully.
Then I installed nodeclipse plugin and create an eclipse Node.js project with empty project template. And I copy my node js script source code into the eclipse node js project.
When I run the node js script in the eclipse node js project, it prompts an error message which said the express module can not be found. How can I fix this issue? I am new to eclipse and Node.js. Thanks.