image created by Margaux Peltat for the Chilled Cow YouTube channel
Time for #DEVDiscuss — right here on DEV 😎
A Comprehensive Beginner's Guide to NPM: Simplifying Package Management
Abishek Haththakage ・ Jul 14 '23
Inspired by @abhixsh's Top 7 post, tonight’s topic is... package management!
If you're not familiar, a package manager is a system that will manage your project dependencies. A dependency is a third-party bit of software, usually written by someone else, that solves a problem for you. Node Package Manager (abbreviated to NPM) is a robust package manager designed for JavaScript projects, primarily used in conjunction with Node.js.
Questions:
- How would you describe your experience with NPM? What do you find most useful about it?
- Which NPM command or feature do you find the most helpful in your day-to-day development work?
- If you've encountered any challenges or difficulties while using NPM, how did you overcome them?
- Any triumphs, fails, or other stories you'd like to share on this topic?
Looking forward to a lively discussion on NPM and package management in general. Let's get started! 🚀
Top comments (5)
Node Package Manager (NPM) is a package manager for the JavaScript programming language. It is used to install, manage, and update JavaScript packages. NPM is a popular package manager for JavaScript, and it is used by millions of developers around the world.
Here are some of the benefits of using NPM:
Easy to use: NPM is very easy to use. You can install packages with the npm install command, and you can update packages with the npm update command.
Wide selection of packages: There are millions of packages available on NPM, so you are sure to find the package you need.
Centralized repository: All NPM packages are stored in a centralized repository, so you can easily find and install the latest versions of packages.
Secure: NPM uses a secure protocol to download packages of chanda na kay, so you can be sure that your packages are safe...
Here are some of the commands you can use with NPM:
npm install package-name: Installs the package named package-name.
npm update package-name: Updates the package named package-name to the latest version.
npm list: Lists all of the packages that are installed on your system.
npm search package-name: Searches for packages that match the name package-name.
npm help: Displays help for the NPM command.
According to GitHub and Wikipedia NPM is not the abbreviation for Node Package Manager. If you go to the npmjs.com/ and click on the navbar, you can see that NPM stands for a lot things. Just a fun fact :)
If you do software development professionally, you will have to use a package manager, regardless of what kind of language do you use (I know, some languages do not have package managers, or do not have official package managers. Let's put them aside for now). You need them because you want to use other people's code, and you want to get this code in a convenient way. Moreover, you have build pipelines which do rely on fetching dependencies automatically. Package managers in general (not just npm) are industry standard at this point. So, I think it is self-explanatory what do I find useful about them.
npm ci
Asking Google mainly. Usually the problem is not with the package manager, it is with a version of a dependency. This is why you want to use
npm ci
.Don't use dependencies such as
left-pad
,is-odd
,is-even
,isarray
, etc. These are dependencies, which you can implement in a few lines of code. At least you will have to download a few bytes less when you will "download the internet" the next time you do annpm install
.I need more information on that. Maybe can manage to improve my App android
I suggest you read up on YARN and the newer Pnpm, both are like npm with superpowers and can be a useful way to install and manage your packages, and that's good to know.