Loading

Quipoin Menu

Learn • Practice • Grow

express-js / ExpressJS Installation
tutorial

ExpressJS Installation

Now that your environment is set up it's time to install Express.js. Just like you install tools before starting a project we'll use npm (Node Package Manager) to add Express to our project.

Installing Express

Open your terminal and make sure you are inside your project folder (the one with package.json). Then run the following command:
npm install express --save
or the short version:
npm i express -S

What Happens During Installation?

  • npm downloads the Express package and its dependencies into a folder called node_modules.
  • It adds an entry to your package.json under dependencies so anyone else working on the project can install the same version.
  • It creates a package-lock.json file that locks the exact versions of every package.

After Installation

Your package.json will now have a dependencies section like this:
{
"name": "my-express-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo ""Error: no test specified"" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.2"
}
}
The caret (^) before the version number means npm can install minor updates automatically.

What is node_modules?

node_modules is a folder where all the installed packages live. It can get very large but you should never commit it to version control (like Git). Instead you share the package.json file and others run npm install to get the same packages.

Two Minute Drill
  • Install Express with npm install express --save.
  • This creates node_modules and updates package.json.
  • Never commit node_modules; use .gitignore.
  • Now you're ready to write your first Express app!

Need more clarification?

Drop us an email at career@quipoinfotech.com