Intro to Node Package Manager

Natalia Wit
2 min readOct 19, 2020

--

JavaScript serves as a critical part of interactive web development for many developers. There is so much JavaScript code out there that developers contribute to, there is also so much duplicate code and code that is solved in many different approaches for the same problem. This is the reason we have JavaScript packages, these packages are made as files and contain reusable code. Packages are made to be shared and they allow developers to use in their own projects. These packages are organized by npm (Node Package Manager).

Although it is very important to learn the skills to solve problems, it will be as important throughout your experience to understand existing code that we can incorporate into our projects. The benefit of existing packages saves us time that we can spend on other features of a project.

Setting up our environment for NPM:

In order to start working with NPM, we need to make sure that we are setup.

If you have Node.js installed then you should be already setup to work with NPM, to check — type this into the command linenode -v. If a version of Node.js appears then it means you have node installed. Another way to double-check npm -v. You can also update your npm by typing in the following command npm install --global npm OR npm install -g npm.

More about NPM:

NPM is a package manager for Javascript, it works with your project directories through the command line by installing existing code written by someone else. There is a different kind of packages out there, event React and Express are npm packages.

The package.json

The package.json file in your project is what tells you and npm what packages will be required for your application. When the npm install command is run, npm reads all of the dependencies in the package.json and downloads them into your project. Those packages are hosted on npmjs.com. When you run the npm install command, it creates a node_modules folder that will contain all of the downloaded packages.

--

--

No responses yet