npm Tutorial - 4 - npm global packages - npm Tutorial For Beginners

preview_player
Показать описание
npm Tutorial - 4 - npm global packages - npm Tutorial For Beginners

What is npm? In 2 minutes - npm tutorial for beginners
----------------------------------
Hellooooo there, beautiful, amazing and gorgeous people.
In this tutorial we will be going over dealing with global packages with npm.
Let’s get started!
There are two ways to install npm packages – locally, and globally. What we have been dealing with so far is only local packages.
Local packages are packages that belong to a project, and these local packages can only be used within that project.
Global packages are packages that belong to your system. They can be used anywhere within your computer. NPM, for example, is a global package that you can use from anywhere within your computer.
Great! Now that we know what a global package is, let’s get into how to deal with them.
In reality, this is all just as simple as installing and uninstalling local packages.
To install a global package, we need the command “npm install –global package-name”. We will go ahead and install the hello-world-npm package through the command npm install –global hello-world-npm. Boom, the package is now installed in our system. That was extremely easy, wasn’t it?
One thing to note is that to install and uninstall global packages you have to have admin permissions in your system, otherwise you will get an error
Alright, you may now have two questions. The first one could be “how do I make sure that the package was installed?” The second question could be “how the heck do I use this package?” They are both great questions.
First, let’s answer the first one. How do we make sure that our package is installed, and how do we see what other packages we have installed globally? We can do this with the command npm ls –global.
As you can see, this command spits out a bunch of crap, and this is mostly because npm is listing the packages we have installed globally along with all of their dependencies. If we want to see ONLY the packages we have installed without their dependencies, you use the command npm ls –global –depth=0. And there is our package! Pretty cool, huh?
Now to the second question – how do we use the package? Well, this is actually much easier than installing the package. All you have to do is type the name of the package you just installed. In our case it will be hello-world-npm. There we go! The package is working, and we can use it anywhere within our system. How amazing is that?
To uninstall the package, it’s as simple as using the command npm uninstall –global package-name, in our case, it will be npm uninstall –global hello-world-npm. Boom. Our package doesn’t exist any more. We can confirm this with the command npm ls –global –depth=0. Our package is not there any more. Awesome!
That is it for now guys. If you have any questions leave a comment for me and I will do my very best to help you out.
As always, please support me by subscribing, liking the video, leaving a comment, and sharing the video with your friends.
See you next time!
Рекомендации по теме
Комментарии
Автор

BOOM! lol... Thank you this video really help.

ja.digital
Автор

I been wondering like crazy how the hell you could access the npm global package. Thanks man.

YvtqKn
Автор

it would've been easier just hello-npm. thanks I like the videos.

erickramones
Автор

How access project window..? which project it support?

MTECSCOSHRADDHAGANESHRAOPOPHAL