Node.js Installation
Node.js is a runtime environment that lets you run JavaScript outside the browser, on a server or the command line. It uses the V8 engine (the same one in Chrome) and comes bundled with npm, the Node package manager. Most modern web development tools, build systems, and frameworks require Node.js to be installed.
I. Install Node.js locally
To install Node.js, navigate to Node.js Homepage , select the option, and download.
For macOS users, you can also use Homebrew
to download Node: brew install node.
To check the current version of Node.js, we can use the command: node -v.
II. npm
npm is a Node package manager installed when you install Node.js.
To check the current version of npm, we can use the command: npm -v.
I recommend installing nodemon, a useful package that automatically restarts the node application when file changes in the directory are detected.
In this example, we save nodemon as devDependencies.
npm i -D nodemon
Check the nodemon version:
nodemon --version
III. Install MongoDB
To install MongoDB, go to https://www.mongodb.com/download-center and choose your version according to the OS.
If you use macOS, you can install MongoDB by Homebrew.
Once you have Homebrew installed, you’ll need to tap the MongoDB formula repository by running the following command in your terminal:
brew tap mongodb/brew
Next, run this command to install MongoDB:
brew install mongodb-community@4.4
To start running Mongo, use this command:
brew services start mongodb
To check the version of MongoDB, run:
mongod --version
IV. Recommended Editors
I recommend using Visual Studio Code for editing. VS Code will give you a solid editor with customization and useful functionality.
To download VS Code (highly recommended), go to its website at https://code.visualstudio.com .