- [Instructor] Sometimes it makes sense to install globally.
For example, I have a CLI tool
for creating new react applications
installed globally on my system.
So let's go over how to manage your global packages.
When you do install globally,
your packages will sit in these directories.
So what you're seeing on screen here
for UNIX-based systems like Mac or Linux,
these are the directories where they'll be installed.
For Windows 7 or later, this is the directory.
You can manage your global directory
with the same commands we'll use throughout the course.
The only exception is that you add
a -g or -global to your command.
So let's try this.
The first thing I'm gonna do is show you
where it is on my own systems.
So I'm in my Macintosh,
so as you can see my hidden files
are showing so now I click on User, Local,
Lib, No modules,
and then I have MPM installed,
and I'm gonna have more as I install globally more packages.
And again, if you don't know how to show your hidden files,
do a simple search on Google: show hidden files Mac,
and you'll see the instructions.
It's a simple command line that looks like this.
And then you click Yes,
and then you do a right-click here and then Relaunch.
And you should be good to go.
Okay, so let's install a package globally
and then let's see what's happening here.
Let's go back here and actually install react.
So what I'm gonna do is install react globally,
like so, and you're gonna see an error.
So here's one thing that could happen from time to time.
In most systems, especially in a Linux world,
you do not have right access to this area.
So you need to do something that's called a sudo,
and then repeat the same command,
and then it's going to ask you
for the actual password for your system.
And then off you go.
If you continue having issues with this,
you can change the directory
where your package is already installed globally.
And this is how you do this.
So, these are the two links that I always go to
when I have issues with MPM and global installs.
You can change the directory
in following these procedures here,
and also on this second link,
if you wanna do it for Windows.
So these are the instructions and you have the links here
if you wanna take a look at how to do that.
So let's go back here, and now I just installed react
and let's install another package
which is called create-react-app,
which is the CLI tool to create new applications with react.
We're all good, and then let's go back here.
And as you see, now my packages are installed in here.
Create-react-app, and react.
And they're not installed locally
on my project which is here.
So if we look at the packages
that are installed in this local project,
you're gonna see that we have a whole bunch,
but not create-react-app.
By the way, these are all dependencies of express.
Okay, so this is a how to manage
your global dependencies and installs.