Installing
First, create a directory to hold your application, if you haven’t already done so, and make that your working directory.
$ mkdir myapp
$ cd myapp
Create a package.json
file in the directory of interest, if it does not exist already, with the npm init
command.
$ npm init
Install Express in the app directory and save it in the dependencies list:
$ npm install express --save
To install Express temporarily, and not add it to the dependencies list, omit the --save
option:
$ npm install express
Node modules installed with the --save
option are added to the dependencies
list in the package.json
file.
Then using npm install
in the app directory will automatically install modules in the dependencies list.