1NPM-INIT(1)                                                        NPM-INIT(1)
2
3
4

NAME

6       npm-init - create a package.json file
7
8   Synopsis
9         npm init [--force|-f|--yes|-y|--scope]
10         npm init <@scope> (same as `npx <@scope>/create`)
11         npm init [<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`)
12
13   Examples
14       Create    a    new    React-based    project   using   create-react-app
15       https://npm.im/create-react-app:
16
17         $ npm init react-app ./my-react-app
18
19       Create    a    new    esm-compatible    package    using     create-esm
20       https://npm.im/create-esm:
21
22         $ mkdir my-esm-lib && cd my-esm-lib
23         $ npm init esm --yes
24
25       Generate a plain old package.json using legacy init:
26
27         $ mkdir my-npm-pkg && cd my-npm-pkg
28         $ git init
29         $ npm init
30
31       Generate it without having it ask any questions:
32
33         $ npm init -y
34
35   Description
36       npm  init  <initializer>  can  be  used to set up a new or existing npm
37       package.
38
39       initializer in this case is an npm package named  create-<initializer>,
40       which  will  be  installed by npx https://npm.im/npx, and then have its
41       main bin executed -- presumably creating or updating  package.json  and
42       running any other initialization-related operations.
43
44       The  init  command  is  transformed to a corresponding npx operation as
45       follows:
46
47npm init foo -> npx create-foo
48
49npm init @usr/foo -> npx @usr/create-foo
50
51npm init @usr -> npx @usr/create
52
53
54       Any additional options will be passed directly to the command,  so  npm
55       init foo --hello will map to npx create-foo --hello.
56
57       If  the  initializer  is  omitted (by just calling npm init), init will
58       fall back to legacy init behavior. It will ask you  a  bunch  of  ques‐
59       tions,  and  then write a package.json for you. It will attempt to make
60       reasonable guesses based on existing fields, dependencies, and  options
61       selected.  It is strictly additive, so it will keep any fields and val‐
62       ues that were already set. You can also use -y/--yes to skip the  ques‐
63       tionnaire  altogether.  If  you  pass  --scope, it will create a scoped
64       package.
65
66   See Also
67https://github.com/isaacs/init-package-json
68
69       • npm help package.json
70
71       • npm help version
72
73       • npm help scope
74
75
76
77
78                                  April 2021                       NPM-INIT(1)
Impressum