Skip to main content
Version: Next

pnpm init

创建 package.json 文件。

¥Create a package.json file.

选项

¥Options

--bare

已添加于:v10.25.0

¥Added in: v10.25.0

创建一个仅包含必需字段的 package.json 文件。

¥Creates a package.json with only the required fields.

--init-type <type>

  • 默认:commonjs

    ¥Default: commonjs

  • 类型:commonjs,模块

    ¥Type: commonjs, module

设置包的模块系统。

¥Set the module system for the package.

--init-package-manager

通过在 package.json 文件中添加 "packageManager" 字段,将项目锁定到当前的 pnpm 版本。

¥Pin the project to the current pnpm version by adding a "packageManager" field to package.json.