Javascript 什么是 NPM,我为什么需要它?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31930370/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is NPM and why do I need it?
提问by user5212895
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 ?
例如,为什么不直接解压框架(例如 Bootstrap 或 Kube)而不使用 NPM,然后准备好使用的文件夹?
Help me to understand please because I'm near the crazy state with all this stuff ...
请帮助我理解,因为我对所有这些东西都接近疯狂状态......
回答by Jakemmarsh
npmis 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 dependenciesinside 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 versionsyour 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 是我工作流程中不可或缺的工具。
回答by Damilola99
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 的包管理器。它有助于安装各种软件包并解决它们的各种依赖关系。它对您的 Node 开发有很大帮助。NPM 可帮助您安装 Web 开发所需的各种模块,而不仅仅是为您提供可能永远不需要的一大堆功能。
回答by Yasir Shabbir Choudhary
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.
- Command line utility to install Node.js packages, do version management and dependency management of Node.js packages.
- 它是一个用于发布开源 Node.js 项目的在线存储库。
- 用于安装 Node.js 包、执行 Node.js 包的版本管理和依赖项管理的命令行实用程序。
回答by Fatma Siam
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 是 Node 的包管理器。它是一个包含数十万条有用代码的存储库,您可能希望将这些代码与您的 Node 项目集成。
npm also has a command line tool that lets us easily install, manage and run projects.
npm 还有一个命令行工具,可以让我们轻松安装、管理和运行项目。
Use npm to . . .
使用 npm 到 . . .
- 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.
- 为您的应用程序调整代码包,或按原样合并包。
- 下载您可以立即使用的独立工具。
- 使用 npx 无需下载即可运行包。
- 在任何地方与任何 npm 用户共享代码。
- 将代码限制给特定的开发人员。
- 创建 Orgs(组织)来协调包维护、编码和开发人员。
- 使用 Orgs 组建虚拟团队。
- 管理多个版本的代码和代码依赖项。
- 更新底层代码时轻松更新应用程序。
- 发现解决同一难题的多种方法。
- 寻找其他正在处理类似问题和项目的开发人员。
READ MORE here
在这里阅读更多
回答by Prashant Maske
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。
回答by Pipo
It stands for node package manager
它代表节点包管理器