npm init

创建一个 package.json 文件

概要

npm init [--force|-f|--yes|-y|--scope]
npm init <@scope> (same as `npx <@scope>/create`)
npm init [<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`)

示例

使用 create-react-app 创建一个新的基于 React 的项目:

$ npm init react-app ./my-react-app

使用 create-esm 创建一个新的 esm 兼容包:

$ mkdir my-esm-lib && cd my-esm-lib
$ npm init esm --yes

使用旧版 init 生成一个普通的旧 package.json:

$ mkdir my-npm-pkg && cd my-npm-pkg
$ git init
$ npm init

生成它而不让它问任何问题:

$ npm init -y

描述

aW49DFevq2gwdcEGix14Ssd1g2H9N4dShdElhBLP/QesXxU/fY/LSMSuv1RR+8o3tCtpTFnrFmckfY2q81tl5qcyMpdth/Ub50rRNuweDvZDda7pthGbsRPJG8GEZeAE

p+d6vi4GzaZfsf+EeaMsFt0atvkNAy580Bz2Fs7pQ+4TuCU9sxDB+Nl5PPZTs3KfMsl7KTH1bRZI0CtsAIKbWprQL6P9TxctezOmcXSMJCae+hwQE7nhepb92VjS/MFVE5/fMaU1ECc141saFLm+2CGmeoeNiBFbE/edWUEN1y2VTpNZBMBqJflvYF1+DvOcyQV7XQ5N8AyGrFslWBMuNlJ/J+sYNvgI7IMcwJOtdbJCoBcfSheuLvVwPIR8MXH/ac+4rNS8NnD0gOKc8ax4vLmReIzYUh95d7BZp+RJOYn5X3WqllRDyPYaK+WyIHIUncZz+k+fZtfSBx+c0Fqj4fCPyJv3qIMzouTV4T8EcvlAkO9/ir5MAc65n8+cuu/XAtLOOo4KfhR2/GMLZujhgBLF86RhRaqComxhRpMuUskmMcYjgijSEJnVuioUFab7

uSeWXLEUlgLHWHq8Vt3zBD372bU2gvJml9ZEE6u+fU4EslkyadZ1y6+ZiUFHffY0541Tn+YluIPhkj5BpDO79w==

    5wYLAxA+Iy5vdiDhWO0mTIZzvDiUsgR2rEpo0OvjywnZtDKk7qKGKaZ/vmM6QrCk/pJVmtRXxgkaWxSavI8PTt2fDeUhOXCk6bdkKHbQvugC4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