1NPM-PUBLISH(1) NPM-PUBLISH(1)
2
3
4
6 npm-publish - Publish a package
7
8 Synopsis
9 npm publish [<tarball>|<folder>] [--tag <tag>] [--access <public|restricted>] [--otp otpcode] [--dry-run]
10
11 Publishes '.' if no argument supplied
12 Sets tag 'latest' if no --tag specified
13
14 Description
15 Publishes a package to the registry so that it can be installed by
16 name. All files in the package directory are included if no local .git‐
17 ignore or .npmignore file exists. If both files exist and a file is
18 ignored by .gitignore but not by .npmignore then it will be included.
19 See npm help developers for full details on what's included in the pub‐
20 lished package, as well as details on how the package is built.
21
22 By default npm will publish to the public registry. This can be over‐
23 ridden by specifying a different default registry or using a npm help
24 scope in the name (see npm help package.json).
25
26 · <folder>: A folder containing a package.json file
27
28 · <tarball>: A url or file path to a gzipped tar archive containing a
29 single folder with a package.json file inside.
30
31 · [--tag <tag>] Registers the published package with the given tag,
32 such that npm install <name>@<tag> will install this version. By
33 default, npm publish updates and npm install installs the latest tag.
34 See npm-dist-tag npm-dist-tag for details about tags.
35
36 · [--access <public|restricted>] Tells the registry whether this pack‐
37 age should be published as public or restricted. Only applies to
38 scoped packages, which default to restricted. If you don't have a
39 paid account, you must publish with --access public to publish scoped
40 packages.
41
42 · [--otp <otpcode>] If you have two-factor authentication enabled in
43 auth-and-writes mode then you can provide a code from your authenti‐
44 cator with this. If you don't include this and you're running from a
45 TTY then you'll be prompted.
46
47 · [--dry-run] As of npm@6, does everything publish would do except
48 actually publishing to the registry. Reports the details of what
49 would have been published.
50
51
52 Fails if the package name and version combination already exists in the
53 specified registry.
54
55 Once a package is published with a given name and version, that spe‐
56 cific name and version combination can never be used again, even if it
57 is removed with npm help unpublish.
58
59 As of npm@5, both a sha1sum and an integrity field with a sha512sum of
60 the tarball will be submitted to the registry during publication. Sub‐
61 sequent installs will use the strongest supported algorithm to verify
62 downloads.
63
64 Similar to --dry-run see npm help pack, which figures out the files to
65 be included and packs them into a tarball to be uploaded to the reg‐
66 istry.
67
68 See Also
69 · npm help registry
70
71 · npm help scope
72
73 · npm help adduser
74
75 · npm help owner
76
77 · npm help deprecate
78
79 · npm help dist-tag
80
81 · npm help pack
82
83 · npm help profile
84
85
86
87
88 February 2021 NPM-PUBLISH(1)