To create your first Node.js project using WebStorm, follow these steps:
Step 1: Install WebStorm
If you don't have WebStorm installed yet, you'll need to download and install it first. You can download the latest version of WebStorm from the JetBrains official website:
https://www.jetbrains.com/webstorm/download/
Follow the installation wizard to complete the installation process.
Step 2: Open WebStorm
Start WebStorm. If running it for the first time, it may prompt you to import settings or configure some initial options.
Step 3: Create a new project
On the WebStorm welcome screen, select the “Create New Project” option.
It can also be created like this:
Step 4: Select project type
In the new project window, select "Node.js and NPM" as the project type from the left menu.
Step 5: Configure project settings
In the “New Project” settings:
- In the Location field, specify the path to the project.
- You can choose a predefined Node.js interpreter, or if you have multiple versions of Node.js installed on your system, you can select one from the drop-down menu. If you don't have Node.js installed yet, WebStorm provides a link to install it.
- Select the Node.js version of your project.
- If necessary, you can check the "Generate a 'package.json' file" option, which will create a
package.json
file containing basic information for your project .
Step 6: Create project
After completing all settings, click the “Create” button. WebStorm will create a new Node.js project for you and open the project window.
Step 7: Create your first JavaScript file
- In the project view, right-click the project root.
- Select "New" and then "JavaScript File."
- Enter a file name, for example
app.js
and press Enter.
Step 8: Write Node.js code
Open the app.js
file you just created and write your first line of Node.js code in it, for example:
console.log('Hello, World!');
Step 9: Run the project
Now, right-click on the app.js
file and select "Run 'app.js'" from the context menu. This will run your Node.js app and display the output in the “Run” window at the bottom.
Step 10: Install dependencies (optional)
If your project requires third-party libraries, you can install them through WebStorm's terminal. At the bottom of WebStorm, find and click the “Terminal” tab, then use the npm command to install the required dependencies, for example:
npm install express --save
Step 11: Explore WebStorm features
Now that your first Node.js project has been created, you can start exploring the various features WebStorm offers, such as code completion, refactoring tools, version control integration, and more.
WebStorm is a powerful IDE designed for JavaScript developers, supporting Node.js, Angular, React, Vue.js, and more. As you become familiar with WebStorm, you'll be able to develop Node.js applications more efficiently.