From the course: Learning Node.js

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Manage third-party packages with npm

Manage third-party packages with npm - Node.js Tutorial

From the course: Learning Node.js

Start my 1-month free trial

Manage third-party packages with npm

- [Narrator] We covered creating our own modules for Node, but what about third party modules? Node has something called a Node Package Manager, or NPM for short. And packages are one or more modules bundled together. One of the more popular packages is called Lodash. Let's cover how we can install it, and then how we can make use of it. Let's go over to our console or terminal. And we'll install it using NPM. So let's type in "npm install lodash". And if we take a look in our directory, we can see a new folder was created, called "node_modules" and inside there, we'll see "lodash". The folder "lodash" itself has several JavaScript files that provide us with all of the functionality and features of Lodash. Now that we have it installed, let's create a file that we'll use to write our own code which will utilize Lodash. So I'll create the new file called "demo.js". Next, we'll use "require" just like we did before for our custom module, to bring in Lodash. And I'll set it in a variable…

Contents