| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 | .TH "NPM\-INIT" "1" "August 2021" "" "".SH "NAME"\fBnpm-init\fR \- create a package\.json file.SS Synopsis.P.RS 2.nfnpm init [\-\-force|\-f|\-\-yes|\-y|\-\-scope]npm init <@scope> (same as `npx <@scope>/create`)npm init [<@scope>/]<name> (same as `npx [<@scope>/]create\-<name>`).fi.RE.SS Examples.PCreate a new React\-based project using \fBcreate\-react\-app\fP \fIhttps://npm\.im/create\-react\-app\fR:.P.RS 2.nf$ npm init react\-app \./my\-react\-app.fi.RE.PCreate a new \fBesm\fP\-compatible package using \fBcreate\-esm\fP \fIhttps://npm\.im/create\-esm\fR:.P.RS 2.nf$ mkdir my\-esm\-lib && cd my\-esm\-lib$ npm init esm \-\-yes.fi.RE.PGenerate a plain old package\.json using legacy init:.P.RS 2.nf$ mkdir my\-npm\-pkg && cd my\-npm\-pkg$ git init$ npm init.fi.RE.PGenerate it without having it ask any questions:.P.RS 2.nf$ npm init \-y.fi.RE.SS Description.P\fBnpm init <initializer>\fP can be used to set up a new or existing npm package\..P\fBinitializer\fP in this case is an npm package named \fBcreate\-<initializer>\fP, whichwill be installed by \fBnpx\fP \fIhttps://npm\.im/npx\fR, and then have its main binexecuted \-\- presumably creating or updating \fBpackage\.json\fP and running any otherinitialization\-related operations\..PThe init command is transformed to a corresponding \fBnpx\fP operation as follows:.RS 0.IP \(bu 2\fBnpm init foo\fP \-> \fBnpx create\-foo\fP.IP \(bu 2\fBnpm init @usr/foo\fP \-> \fBnpx @usr/create\-foo\fP.IP \(bu 2\fBnpm init @usr\fP \-> \fBnpx @usr/create\fP.RE.PAny additional options will be passed directly to the command, so \fBnpm init foo\-\-hello\fP will map to \fBnpx create\-foo \-\-hello\fP\|\..PIf the initializer is omitted (by just calling \fBnpm init\fP), init will fall backto legacy init behavior\. It will ask you a bunch of questions, and then write apackage\.json for you\. It will attempt to make reasonable guesses based onexisting fields, dependencies, and options selected\. It is strictly additive, soit will keep any fields and values that were already set\. You can also use\fB\-y\fP/\fB\-\-yes\fP to skip the questionnaire altogether\. If you pass \fB\-\-scope\fP, itwill create a scoped package\..SS See Also.RS 0.IP \(bu 2https://github\.com/isaacs/init\-package\-json.IP \(bu 2npm help package\.json.IP \(bu 2npm help version.IP \(bu 2npm help scope.RE
 |