- [Instructor] The first step, and one
that you might have encountered already,
is adding packages locally, or globally.
But what it the difference between the two?
When a package is installed locally,
it is installed on your project's directory.
In this case, the one we're working on.
When it is installed globally,
it will be installed in your system,
available to all projects.
But we'll get back to that later.
So, let's explore how to add a new package.
So, if we take a look at our project files.
So, if we take a look at the
index, we are importing express.
And here we are using presets, so
we're using environment and then stage 0.
Alright, so let's go back to our package.jason file,
and then open up our terminal.
And let's start working on this.
So, first we're going to install express.
And the syntax to install, or add a package, is
npm, install, and then the name of the package.
And then Enter.
And it's going to install that new project, in our package.
So what you're going to see now is
a new dependency installed inside of our package.jason file.
And you will see, a folder called node modules.
And this is where express has been installed.
So, these are the regular dependencies.
So, these are the dependencies
that will be included with your project.
But what if you wanted to have dependencies that you
only want to use while you're working on the project,
but you don't want them to be used at the final project.
This is how you do it.
So again, we do npm, install,
and the name, or the names, so
if you wanna add multiple dependencies,
you can literally list them all in one go.
So, we could do something like babel-cli,
So, we could do something like babel-cli.
Babel-preset-stage-0.
Babel-preset-es2015
And you might say, "Wait a minute.
"Why are you installing this one when in this
"configuration files, the babelrc file.
"It says environment, as opposed to the preset-es2015."
Well, I'm going to come back to that.
So, let's install install it for now.
And then, come back to that afterwards.
'Kay?
And the actually keyword to install dev dependencies
is dash dash, save, dash, dev.
is dash dash, save, dash, D E V.
As dev.
And, by the way, you can already tell that,
what we're installing here.
The babel-preset-es2015 is not the right one,
so that's cool, I'm doing this on purpose.
And we'll get back to that later on.
So now, it's added the packages.
And you can see, we have a dev dependency.
So, what exactly are dev dependencies?
It basically tells npm to install these as dev tools.
Which means they won't be included in
your production bill, but used throughout development.
So when you compile the production bill,
these dependencies won't be included.
Like our babel packages, which helps us
compile es6 code to something that the web understands.
Alright, so now that we have installed
and added a few packages, let's move on.