Node.js works on Windows, Linux, and Mac. It supports both 32-bit and 64-bit platforms. To install Node.js on Windows, simply download the Windows setup as shown below.
Node.js can be downloaded and installed from the official website or via a package manager such as npm (Node Package Manager) or nvm (Node Version Manager). When you run node.js setup for Windows, the setup dialogue will appear as seen below. Now, simply follow the installation instructions to get it installed on your PC.
Select a text editor or an Integrated Development Environment (IDE) designed for JavaScript development. Popular options include Visual Studio Code, Sublime Text, Atom, and WebStorm.
After Node.js is successfully installed, an icon will appear on the Windows menu. Now, click this menu to launch the Node.js console.
You may also launch the node.js command prompt from the run window.
When you put the node in the run window and hit enter, the node.js command prompt appears, as shown below.
Node.js includes npm by default. Ensure that it is correctly installed and configured. You will use it to manage dependencies and execute scripts.
Node packages are open-source libraries that are integrated into your Node project. These packages are installed in your machine's node_modules folder.
Node packages come in two types:
Local packages are installed on the project level. These are installed in the node_modules folder of the parent working directory, sometimes known as the project-level folder.
Global packages are installed in a global location. On Windows, these are often installed under the /users/username/AppData/Roaming/npm/node_modules folder.
Run npm init in the project directory to generate a package.json file. This file will include metadata for your project and its dependencies.
Using npm, install any dependencies that your project requires. For example, running npm install express installs the Express framework.
To get started, create a JavaScript file (for example, app.js). You can use this file to configure your server, define routes, and manage requests.
Run your Node.js application from the terminal. For example, node app.js. You may also use nodemon to automate server restarts during development.