@
has different meanings according to its place where it is in the npm package name.
A package is:
- A folder containing a program described by a
package.json
file.
- A gzipped tarball containing (1).
- A url that resolves to (2).
- A
<name>@<version>
that is published on the registry with (3).
- A
<name>@<tag>
that points to (4).
- A
<name>
that has a “latest” tag satisfying (5).
- A
<git remote url>
that resolves to (1).
npm install [<@scope>/]<name>
<scope>
is optional. The package will be downloaded from the registry associated with the specified scope. If no registry is associated with the given scope the default registry is assumed.
Note: if you do not include the @
-symbol on your scope name, npm will interpret this as a GitHub repository instead, see below. Scopes names must also be followed by a slash.
npm install [<@scope>/]<name>@<tag>
Install the version of the package that is referenced by the specified tag. If the tag does not exist in the registry data for that package, then this will fail.
Example:
npm install packagename@latest
npm install @myorg/mypackage@latest
npm install [<@scope>/]<name>@<version>
Install the specified version of the package. This will fail if the version has not been published to the registry.
Example:
npm install [email protected]
npm install @myorg/[email protected]
npm install [<@scope>/]<name>@<version range>
Install a version of the package matching the specified version range.
Example:
npm install packagename@">=0.1.0 <0.2.0"
npm install @myorg/privatepackage@">=0.1.0 <0.2.0"
npm help scope