What is NPM and why do I need it?

2020-05-12 18:33发布

问题:

In the past, I made some websites with notepad for example, so we must create a folder TREE and put into it a .htm file, and some folderS with stuff like Javascript, css ...

Maybe I don't understand what NPM really brings, because It seems to do the same thing but automated it ... is it just that ?

For example, why not just unpack a frameworks (e.g. Bootstrap or Kube) without use of NPM and so have folders ready to use ?

Help me to understand please because I'm near the crazy state with all this stuff ...

回答1:

npm is a package manager for Node.js with hundreds of thousands of packages. Although it does create some of your directory structure/organization, this is not the main purpose.

The main goal, as you touched upon, is automated dependency and package management. This means that you can specify all of your project's dependencies inside your package.json file, then any time you (or anyone else) needs to get started with your project they can just run npm install and immediately have all of the dependencies installed. On top of this, it is also possible to specify what versions your project depends upon to prevent updates from breaking your project.

It is definitely possible to manually download your libraries, copy them into the correct directories, and use them that way. However, as your project (and list of dependencies) grows, this will quickly become time-consuming and messy. It also makes collaborating and sharing your project that much more difficult.

Hopefully this makes it more clear what the purpose of npm is. As a Javascript developer (both client-side and server-side), npm is an indispensable tool in my workflow.



回答2:

NPM basically is the package manager for node. It helps with installing various packages and resolving their various dependencies. It greatly helps with your Node development. NPM helps you install the various modules you need for your web development and not just given you a whole bunch of features you might never need.



回答3:

NPM is a Node Package Manager and it's use for

  • it is an online repository for the publishing of open-source Node.js projects.
  • Command line utility to install Node.js packages, do version management and dependency management of Node.js packages.


回答4:

npm is Node's package manager. It's a repository of hundreds of thousands of useful pieces of code that you may want to integrate with your Node project.

npm also has a command line tool that lets us easily install, manage and run projects.

Use npm to . . .

  • Adapt packages of code for your apps, or incorporate packages as they are.
  • Download standalone tools you can use right away.
  • Run packages without downloading using npx.
  • Share code with any npm user, anywhere.
  • Restrict code to specific developers.
  • Create Orgs (organizations) to coordinate package maintenance, coding, and developers.
  • Form virtual teams by using Orgs.
  • Manage multiple versions of code and code dependencies.
  • Update applications easily when underlying code is updated.
  • Discover multiple ways to solve the same puzzle.
  • Find other developers who are working on similar problems and projects.

READ MORE here



回答5:

NPM is a node package manager. It is basically used for managing dependencies of various server side dependencies.

We can manages our server side dependencies manually as well but once our project's dependencies grow it becomes difficult to install and manage.

By using NPM it becomes easy, we just need to install NPM once for all dependencies.



回答6:

It stands for node package manager