1 ---
2 title: package-spec
3 section: 7
4 description: Package name specifier
5 github_repo: npm/cli
6 github_branch: release/v10
7 github_path: docs/lib/content/using-npm/package-spec.md
8 redirect_from:
9 - /cli-documentation/v10/misc/package-spec
10 - /cli-documentation/v10/using-npm/package-spec
11 - /cli/v10/misc/package-spec
12 ---
13
14 ### Description
15
16 Commands like `npm install` and the dependency sections in the `package.json` 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 `<package-spec>` in the help output for the npm commands that use this package name specifier.
17
18 ### Package name
19
20 - `[<@scope>/]<pkg>`
21 - `[<@scope>/]<pkg>@<tag>`
22 - `[<@scope>/]<pkg>@<version>`
23 - `[<@scope>/]<pkg>@<version range>`
24
25 Refers 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 [registry](/cli/v10/using-npm/config#registry) config to refer to a package in a registry.
26
27 Examples:
28
29 - `npm`
30 - `@npmcli/arborist`
31 - `@npmcli/arborist@latest`
32 - `npm@6.13.1`
33 - `npm@^4.0.0`
34
35 ### Aliases
36
37 - `<alias>@npm:<name>`
38
39 Primarily used by commands like `npm install` and in the dependency sections in the `package.json`, this refers to a package by an alias. The `<alias>` is the name of the package as it is reified in the `node_modules` folder, and the `<name>` refers to a package name as found in the configured registry.
40
41 See `Package name` above for more info on referring to a package by name, and [registry](/cli/v10/using-npm/config#registry) for configuring which registry is used when referring to a package by name.
42
43 Examples:
44
45 - `semver:@npm:@npmcli/semver-with-patch`
46 - `semver:@npm:semver@7.2.2`
47 - `semver:@npm:semver@legacy`
48
49 ### Folders
50
51 - `<folder>`
52
53 This refers to a package on the local filesystem. Specifically this is a folder with a `package.json` file in it. This _should_ always be prefixed with a `/` or `./` (or your OS equivalent) to reduce confusion. npm currently will parse a string with more than one `/` in it as a folder, but this is legacy behavior that may be removed in a future version.
54
55 Examples:
56
57 - `./my-package`
58 - `/opt/npm/my-package`
59
60 ### Tarballs
61
62 - `<tarball file>`
63 - `<tarball url>`
64
65 Examples:
66
67 - `./my-package.tgz`
68 - `https://registry.npmjs.org/semver/-/semver-1.0.0.tgz`
69
70 Refers 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.
71
72 ### git urls
73
74 - `<git:// url>`
75 - `<github username>/<github project>`
76
77 Refers 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 `#ref`.
78
79 Examples:
80
81 - `https://github.com/npm/cli.git`
82 - `git@github.com:npm/cli.git`
83 - `git+ssh://git@github.com/npm/cli#v6.0.0`
84 - `github:npm/cli#HEAD`
85 - `npm/cli#c12ea07`
86
87 ### See also
88
89 - [npm-package-arg](https://npm.im/npm-package-arg)
90 - [scope](/cli/v10/using-npm/scope)
91 - [config](/cli/v10/using-npm/config)