This readme will guide you through the process of installing Node.js and setting up a Node.js development environment using Visual Studio Code.
Before you begin, ensure that you have the following software installed:
- Node.js (version 12 or higher)
- Visual Studio Code
To install Node.js, follow these steps:
- Go to the official Node.js website.
- Download the appropriate installer for your operating system.
- Run the installer and follow the installation instructions.
To set up a Node.js development environment with Visual Studio Code, follow these steps:
-
Open Visual Studio Code.
-
Click on the Extensions icon in the Activity Bar on the side of the screen (or press
Ctrl+Shift+X
). -
Search for and install the "Node.js Extension Pack" extension.
-
Press
Ctrl+Shift+P
to open the Command Palette. -
Type "Terminal: Create New Integrated Terminal" and select it to open a new terminal window.
-
In the terminal window, type
node -v
to verify that Node.js is installed. -
Create a new folder for your project and open it in Visual Studio Code.
-
Create a new file named
app.js
in your project folder. -
Add the following code to
app.js
:console.log("Hello, World!");
-
Save the file.
-
Open the terminal window in Visual Studio Code by clicking on the Terminal tab in the bottom panel of the screen.
-
Type
node app.js
in the terminal window and press Enter to run the code. -
You should see the message "Hello, World!" displayed in the terminal window. Congratulations! You have successfully installed Node.js and set up a Node.js development environment with Visual Studio Code.