1PACKAGE-SPEC(7)                                                PACKAGE-SPEC(7)
2
3
4

NAME

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