简体   繁体   English

什么是“package.json”文件?

[英]What is the 'package.json' file?

As a new developer I'd like more information about JSON files.作为一名新开发人员,我想了解有关 JSON 文件的更多信息。 I know that this file is the heart of a Node.js system.我知道这个文件是一个Node.js系统的核心。 This file holds the metadata for a particular project.该文件包含特定项目的元数据。 The file is found in the root directory of any Node.js application or module.该文件位于任何 Node.js 应用程序或模块的根目录中。 What is some more information about it?关于它的更多信息是什么?

The package.json file is the essential part to understand, learn and work with Node.js. It is the first step to learning about development in Node.js. package.json文件是了解、学习和使用Node.js必不可少的部分,是学习Node.js开发的第一步。

The metadata information in the package.json file can be categorized into the below categories: package.json文件中的元数据信息可以分为以下几类:

  1. It basically consists of the properties to identify the module/project such as the name of the project, current version of the module, license, author of the project, description of the project, etc.它基本上由标识模块/项目的属性组成,例如项目名称、模块的当前版本、许可证、项目作者、项目描述等。

  2. As the name suggests, it consists of the functional values/properties of the project/module such as the entry/starting point of the module, dependencies in the project, scripts being used, repository links of the Node project, etc.顾名思义,它由项目/模块的功能值/属性组成,例如模块的入口/起点、项目中的依赖项、正在使用的脚本、Node 项目的存储库链接等。

The package. json file is the heart of any Node project. package.json 文件是任何 Node 项目的核心。 It records important metadata about a project which is required before publishing to NPM, and also defines functional attributes of a project that npm uses to install dependencies, run scripts, and identify the entry point to our package.它记录了发布到 NPM 之前需要的项目的重要元数据,还定义了项目的功能属性,npm 用于安装依赖项、运行脚本和识别我们的 package 的入口点。

All npm packages contain a file, usually in the project root, called package.json - this file holds various metadata relevant to the project.所有 npm 包都包含一个文件,通常位于项目根目录中,名为 package.json - 该文件包含与项目相关的各种元数据。 This file is used to give information to npm that allows it to identify the project as well as handle the project's dependencies.该文件用于向 npm 提供信息,使其能够识别项目并处理项目的依赖项。 It can also contain other metadata such as a project description, the version of the project in a particular distribution, license information, even configuration data - all of which can be vital to both npm and to the end users of the package. The package.json file is normally located at the root directory of a Node.js project.它还可以包含其他元数据,例如项目描述、特定发行版中的项目版本、许可证信息,甚至配置数据 - 所有这些对于 npm 和 package 的最终用户都至关重要。package.json 文件通常位于 Node.js 项目的根目录中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM