Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
A package.json file is the standard way to manage your dependencies in a project. In this video you'll learn how to create your first package.json file.
Terminal Commands
- Clear the screen
clear
npm Command Line Usage
-
Get help for a command
npm <command> -h
- e.g.
npm init -h
-
Initializing a
package.json
file-
npm init
-
npm help json
for what each of the fields in thepackage.json
does
-
-
Installing an npm Package as a dependency
npm install colors --save
-
Installing an npm Package as a development dependency
npm install mocha --save-dev
-
Install all packages specified in your
package.json
npm install <flags>
- e.g.
npm install
- e.g.
npm install --python=python2
-
Running npm in a production environment
NODE_ENV=production npm install
Git Usage
To ignore files create a .gitignore
and add the files and folders you want to ignore.
Example .gitignore
file:
node_modules/
.DS_Store
config/database.yml
You need to sign up for Treehouse in order to download course files.
Sign up