codekingpro/portable-devtools
114k
1.TH "SPEC" "7" "April 2026" "NPM@11.13.0" ""
2.SH "NAME"
3\fBspec\fR - Package name specifier
4.SS "Description"
5.P
6Commands like \fBnpm install\fR and the dependency sections in the \fBpackage.json\fR use a package name specifier. This can be many different things that all refer to a "package". Examples include a package name, git url, tarball, or local directory. These will generally be referred to as \fB<package-spec>\fR in the help output for the npm commands that use this package name specifier.
7.SS "Package name"
8.RS 0
9.IP \(bu 4
10\fB\[lB]<@scope>/\[rB]<pkg>\fR
11.IP \(bu 4
12\fB\[lB]<@scope>/\[rB]<pkg>@<tag>\fR
13.IP \(bu 4
14\fB\[lB]<@scope>/\[rB]<pkg>@<version>\fR
15.IP \(bu 4
16\fB\[lB]<@scope>/\[rB]<pkg>@<version range>\fR
17.RE 0
18
19.P
20Refers to a package by name, with or without a scope, and optionally tag, version, or version range. This is typically used in combination with the \fBregistry\fR \fI\(la/using-npm/config#registry\(ra\fR config to refer to a package in a registry.
21.P
22Examples:
23.RS 0
24.IP \(bu 4
25\fBnpm\fR
26.IP \(bu 4
27\fB@npmcli/arborist\fR
28.IP \(bu 4
29\fB@npmcli/arborist@latest\fR
30.IP \(bu 4
31\fBnpm@6.13.1\fR
32.IP \(bu 4
33\fBnpm@^4.0.0\fR
34.RE 0
35
36.SS "Aliases"
37.RS 0
38.IP \(bu 4
39\fB<alias>@npm:<name>\fR
40.RE 0
41
42.P
43Primarily used by commands like \fBnpm install\fR and in the dependency sections in the \fBpackage.json\fR, this refers to a package by an alias. The \fB<alias>\fR is the name of the package as it is reified in the \fBnode_modules\fR folder, and the \fB<name>\fR refers to a package name as found in the configured registry.
44.P
45See \fBPackage name\fR above for more info on referring to a package by name, and \fBregistry\fR \fI\(la/using-npm/config#registry\(ra\fR for configuring which registry is used when referring to a package by name.
46.P
47Examples:
48.RS 0
49.IP \(bu 4
50\fBsemver@npm:@npmcli/semver-with-patch\fR
51.IP \(bu 4
52\fBsemver@npm:semver@7.2.2\fR
53.IP \(bu 4
54\fBsemver@npm:semver@legacy\fR
55.RE 0
56
57.SS "Folders"
58.RS 0
59.IP \(bu 4
60\fB<folder>\fR
61.RE 0
62
63.P
64This refers to a package on the local filesystem. Specifically this is a folder with a \fBpackage.json\fR file in it. This \fIshould\fR always be prefixed with a \fB/\fR or \fB./\fR (or your OS equivalent) to reduce confusion. npm currently will parse a string with more than one \fB/\fR in it as a folder, but this is legacy behavior that may be removed in a future version.
65.P
66Examples:
67.RS 0
68.IP \(bu 4
69\fB./my-package\fR
70.IP \(bu 4
71\fB/opt/npm/my-package\fR
72.RE 0
73
74.SS "Tarballs"
75.RS 0
76.IP \(bu 4
77\fB<tarball file>\fR
78.IP \(bu 4
79\fB<tarball url>\fR
80.RE 0
81
82.P
83Examples:
84.RS 0
85.IP \(bu 4
86\fB./my-package.tgz\fR
87.IP \(bu 4
88\fBhttps://registry.npmjs.org/semver/-/semver-1.0.0.tgz\fR
89.RE 0
90
91.P
92Refers to a package in a tarball format, either on the local filesystem or remotely via url. This is the format that packages exist in when uploaded to a registry.
93.SS "git urls"
94.RS 0
95.IP \(bu 4
96\fB<git:// url>\fR
97.IP \(bu 4
98\fB<github username>/<github project>\fR
99.RE 0
100
101.P
102Refers to a package in a git repo. This can be a full git url, git shorthand, or a username/package on GitHub. You can specify a git tag, branch, or other git ref by appending \fB#ref\fR.
103.P
104Examples:
105.RS 0
106.IP \(bu 4
107\fBhttps://github.com/npm/cli.git\fR
108.IP \(bu 4
109\fBgit@github.com:npm/cli.git\fR
110.IP \(bu 4
111\fBgit+ssh://git@github.com/npm/cli#v6.0.0\fR
112.IP \(bu 4
113\fBgithub:npm/cli#HEAD\fR
114.IP \(bu 4
115\fBnpm/cli#c12ea07\fR
116.RE 0
117
118.SS "See also"
119.RS 0
120.IP \(bu 4
121\fBnpm-package-arg\fR \fI\(lahttps://npm.im/npm-package-arg\(ra\fR
122.IP \(bu 4
123npm help scope
124.IP \(bu 4
125npm help config
126.RE 0
127 