什么是NPM,为什么需要它?

时间:2022-05-21 02:06:42

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 ...

在过去,我用记事本制作了一些网站,所以我们必须创建一个文件夹TREE,然后放入一个.htm文件,还有一些像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 ?

也许我不明白NPM真正带来了什么,因为它似乎做了同样的事情,但自动化它......就是这样吗?

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

例如,为什么不在不使用NPM的情况下解压缩框架(例如Bootstrap或Kube),以便准备好使用文件夹?

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

请帮助我理解,因为我已经接近了所有这些东西的疯狂状态......

5 个解决方案

#1


53  

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.

npm是Node.js的包管理器,包含数十万个包。虽然它确实创建了一些目录结构/组织,但这不是主要目的。

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.

正如您所提到的,主要目标是自动依赖和包管理。这意味着您可以在package.json文件中指定项目的所有依赖项,然后只要您(或其他任何人)需要开始使用项目,他们就可以运行npm install并立即安装所有依赖项。除此之外,还可以指定项目所依赖的版本,以防止更新破坏项目。

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.

希望这更清楚地说明了npm的目的是什么。作为一个Javascript开发人员(客户端和服务器端),npm是我工作流程中不可或缺的工具。

#2


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.

NPM基本上是节点的包管理器。它有助于安装各种包并解决它们的各种依赖关系。它极大地有助于您的Node开发。 NPM可以帮助您安装Web开发所需的各种模块,而不仅仅是为您提供了一系列您可能永远不需要的功能。

#3


2  

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

NPM是一个节点包管理器,它的用途

  • it is an online repository for the publishing of open-source Node.js projects.
  • 它是一个用于发布开源Node.js项目的在线存储库。
  • Command line utility to install Node.js packages, do version management and dependency management of Node.js packages.
  • 用于安装Node.js包的命令行实用程序,执行Node.js包的版本管理和依赖关系管理。

#4


0  

It stands for node package manager

它代表节点包管理器

#5


-1  

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

NPM是节点包管理器。它主要用于管理各种服务器端依赖项的依赖关系。

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.

通过使用NPM变得简单,我们只需要为所有依赖项安装一次NPM。

#1


53  

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.

npm是Node.js的包管理器,包含数十万个包。虽然它确实创建了一些目录结构/组织,但这不是主要目的。

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.

正如您所提到的,主要目标是自动依赖和包管理。这意味着您可以在package.json文件中指定项目的所有依赖项,然后只要您(或其他任何人)需要开始使用项目,他们就可以运行npm install并立即安装所有依赖项。除此之外,还可以指定项目所依赖的版本,以防止更新破坏项目。

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.

希望这更清楚地说明了npm的目的是什么。作为一个Javascript开发人员(客户端和服务器端),npm是我工作流程中不可或缺的工具。

#2


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.

NPM基本上是节点的包管理器。它有助于安装各种包并解决它们的各种依赖关系。它极大地有助于您的Node开发。 NPM可以帮助您安装Web开发所需的各种模块,而不仅仅是为您提供了一系列您可能永远不需要的功能。

#3


2  

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

NPM是一个节点包管理器,它的用途

  • it is an online repository for the publishing of open-source Node.js projects.
  • 它是一个用于发布开源Node.js项目的在线存储库。
  • Command line utility to install Node.js packages, do version management and dependency management of Node.js packages.
  • 用于安装Node.js包的命令行实用程序,执行Node.js包的版本管理和依赖关系管理。

#4


0  

It stands for node package manager

它代表节点包管理器

#5


-1  

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

NPM是节点包管理器。它主要用于管理各种服务器端依赖项的依赖关系。

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.

通过使用NPM变得简单,我们只需要为所有依赖项安装一次NPM。