.TH "NPM\-PUBLISH" "1" "November 2023" "9.2.0" .SH "NAME" \fBnpm-publish\fR .SH Synopsis .SH Description .P Publishes a package to the registry so that it can be installed by name\. .P By default npm will publish to the public registry\. This can be .br overridden by specifying a different default registry or using a .br \fBscope\fP in the name, combined with a .br scope\-configured registry (see .br \fBpackage\.json\fP)\. .P A \fBpackage\fP is interpreted the same way as other commands (like .br \fBnpm install\fP and can be: .RS 1 .IP \(bu 2 a) a folder containing a program described by a .br \fBpackage\.json\fP file .IP \(bu 2 b) a gzipped tarball containing (a) .IP \(bu 2 c) a url that resolves to (b) .IP \(bu 2 d) a \fB@\fP that is published on the registry (see .br \fBregistry\fP) with (c) .IP \(bu 2 e) a \fB@\fP (see \fBnpm dist\-tag\fP) that .br points to (d) .IP \(bu 2 f) a \fB\fP that has a "latest" tag satisfying (e) .IP \(bu 2 g) a \fB\fP that resolves to (a) .RE .P The publish will fail if the package name and version combination already .br exists in the specified registry\. .P Once a package is published with a given name and version, that specific .br name and version combination can never be used again, even if it is removed .br with \fBnpm unpublish\fP\|\. .P As of \fBnpm@5\fP, both a sha1sum and an integrity field with a sha512sum of the .br tarball will be submitted to the registry during publication\. Subsequent .br installs will use the strongest supported algorithm to verify downloads\. .P Similar to \fB\-\-dry\-run\fP see \fBnpm pack\fP, which figures .br out the files to be included and packs them into a tarball to be uploaded .br to the registry\. .SH Files included in package .P To see what will be included in your package, run \fBnpx npm\-packlist\fP\|\. All .br files are included by default, with the following exceptions: .RS 1 .IP \(bu 2 Certain files that are relevant to package installation and distribution .br are always included\. For example, \fBpackage\.json\fP, \fBREADME\.md\fP, .br \fBLICENSE\fP, and so on\. .IP \(bu 2 If there is a "files" list in .br \fBpackage\.json\fP, then only the files .br specified will be included\. (If directories are specified, then they .br will be walked recursively and their contents included, subject to the .br same ignore rules\.) .IP \(bu 2 If there is a \fB\|\.gitignore\fP or \fB\|\.npmignore\fP file, then ignored files in .br that and all child directories will be excluded from the package\. If .br \fIboth\fR files exist, then the \fB\|\.gitignore\fP is ignored, and only the .br \fB\|\.npmignore\fP is used\. .P \fB\|\.npmignore\fP files follow the same pattern .br rules .br as \fB\|\.gitignore\fP files .IP \(bu 2 If the file matches certain patterns, then it will \fInever\fR be included, .br unless explicitly added to the \fB"files"\fP list in \fBpackage\.json\fP, or .br un\-ignored with a \fB!\fP rule in a \fB\|\.npmignore\fP or \fB\|\.gitignore\fP file\. .IP \(bu 2 Symbolic links are never included in npm packages\. .RE .P See \fBdevelopers\fP for full details on what's .br included in the published package, as well as details on how the package is .br built\. .SH Configuration .SH See Also .RS 1 .IP \(bu 2 package spec .IP \(bu 2 npm\-packlist package .IP \(bu 2 npm registry .IP \(bu 2 npm scope .IP \(bu 2 npm adduser .IP \(bu 2 npm owner .IP \(bu 2 npm deprecate .IP \(bu 2 npm dist\-tag .IP \(bu 2 npm pack .IP \(bu 2 npm profile .RE