创建 Node.js 模块
See Details
目录
Node.js 模块是一种可以发布到 npm 的 包。
¥Node.js modules are a type of package that can be published to npm.
概述
¥Overview
创建 package.json 文件
¥Create a package.json file
-
要创建
package.json文件,请在命令行中,在 Node.js 模块的根目录中运行npm init:¥To create a
package.jsonfile, on the command line, in the root directory of your Node.js module, runnpm init:-
对于 范围模块,运行
npm init --scope=@scope-name¥For scoped modules, run
npm init --scope=@scope-name -
对于 无范围的模块,运行
npm init¥For unscoped modules, run
npm init
-
-
为必填字段(
name和version)以及main字段提供响应:¥Provide responses for the required fields (
nameandversion), as well as themainfield:-
name:你的模块的名称。¥
name: The name of your module. -
version
-