If you've just installed npm
, it'll save you some time later if you set some defaults in your config:
-
Set your name
$ npm config set init-author-name "your name"
-
Optional: Set your preferred license type (default is ISC):
$ npm config set init-license "MIT"
-
Add the following to a
.gitignore
file in the root of your project:node_modules npm-debug.log
- One of the advantages of using npm is that we don't need to commit dependencies to our projects. Instead we
git pull
and thennpm install
.
- One of the advantages of using npm is that we don't need to commit dependencies to our projects. Instead we
-
Download or clone this project into your workspace;
-
Initialize an
npm
project by creating apackage.json
file:$ npm init
-
You will be asked to confirm the details of your project.
-
See Anatomy of a package.json file for more details.
-
You can skip these questions with the
-y
flag:$ npm init -y
-
-
Once complete, you should have a new
package.json
file in your project directory. -
Install your first package!
$ npm install <project-name>
- Search: "Best npm packages for developers"