- [Instructor] When I get errors,
especially weird ones I've never seen before,
I always use three sources to find solutions,
and typically do very quickly.
So the first one I would go to first
is the documentation for NPM.
So, once you get to the Docs home,
you can go to Getting Started,
and then scroll until you see Troubleshooting,
and then Common Errors,
and you'll find most of the common errors
that you could see in the terminal.
The second obvious source is Google,
so you can enter the error you see in the terminal,
and once you actually search for it,
you should find answers to your questions.
The last one I would go to is Stack Overflow.
So if you're seeing complex messages inside of your terminal
and you want to make sure that you have all the right steps
to fix it, or nothing is working,
Stack Overflow is a good place to get started
with the actual text that you're getting from the terminal,
and then enter it in the question here,
and then find your answers.
So with these three sources, most likely,
you'll find what you need and be able to fix it quickly.
But let me run through the most common ones.
The first one you'll get sometimes,
especially if you change systems,
or work off different computers,
is a permission error, which typically start
with EACCES and then some wording.
You could also get an error that looks like this,
Error: ENOENT, and so on, so forth.
This is due to your system access
to install the files in question.
You can either do a sudo before the command,
and it will ask you for your password,
so for example, if we go to our terminal,
we could do something like this:
sudo npm install, and then, -g if you want to install
these dependencies globally,
and that's typically something that happens.
You want to install something locally in your system,
you don't have the right access,
then you need to do a sudo.
So when you do something like this
and then enable the package,
you will get asked for your password.
And then do a search on Google
for resolving access error with NPM on Windows or on Mac
and you'll find several articles
how to resolve it based on your system
if this doesn't work.
Also, the one that we've explored in this chapter
is if you see weird, unexplainable errors,
always try to resolve the cache to see if it fixes it.
It shouldn't be an issue with the latest versions of NPM,
but in the worst case it does, try that.
And last, one of the most common error you'll see
are warnings about deprecated packages,
something that you could see when you install new packages,
or you installed a project that has dependencies
that are old and deprecated,
you'll see those type of messages.
They'll either be yellow,
which means you need to pay attention to it,
but not troublesome yet,
or red, which means it could be breaking your application.
My best piece of advice whenever you see those warnings,
read them and look into it by visiting
the package owner or repo.
If not already, do post an issue on the repo
that their package might be an issue
with such-and-such other packages,
or syntax that will no longer work.
On your end, I'd suggest you find an alternative
to this particular syntax or package
before it breaks your own app.
These are the most common issues,
but do go through the NPM docs to see others,
such as the ones we see here,
to make sure you have a good grasp of what could happen.