@@ -7,10 +7,11 @@ npm-install(1) -- Install a package
7
7
npm install <tarball file>
8
8
npm install <tarball url>
9
9
npm install <folder>
10
- npm install <name>
10
+ npm install <name> [--save|--save-dev|--save-optional]
11
11
npm install <name>@<tag>
12
12
npm install <name>@<version>
13
13
npm install <name>@<version range>
14
+ npm install <name>@<version range>
14
15
15
16
## DESCRIPTION
16
17
@@ -35,88 +36,116 @@ after packing it up into a tarball (b).
35
36
36
37
37
38
* ` npm install ` (in package directory, no arguments):
38
- Install the dependencies in the local node_modules folder.
39
39
40
- In global mode (ie, with ` -g ` or ` --global ` appended to the command),
41
- it installs the current package context (ie, the current working
42
- directory) as a global package.
40
+ Install the dependencies in the local node_modules folder.
41
+
42
+ In global mode (ie, with ` -g ` or ` --global ` appended to the command),
43
+ it installs the current package context (ie, the current working
44
+ directory) as a global package.
45
+
43
46
44
47
* ` npm install <folder> ` :
45
- Install a package that is sitting in a folder on the filesystem.
48
+
49
+ Install a package that is sitting in a folder on the filesystem.
46
50
47
51
* ` npm install <tarball file> ` :
48
- Install a package that is sitting on the filesystem. Note: if you just want
49
- to link a dev directory into your npm root, you can do this more easily by
50
- using ` npm link ` .
51
52
52
- Example:
53
+ Install a package that is sitting on the filesystem. Note: if you just want
54
+ to link a dev directory into your npm root, you can do this more easily by
55
+ using ` npm link ` .
56
+
57
+ Example:
53
58
54
- npm install ./package.tgz
59
+ npm install ./package.tgz
55
60
56
61
* ` npm install <tarball url> ` :
57
- Fetch the tarball url, and then install it. In order to distinguish between
58
- this and other options, the argument must start with "http://" or "https://"
59
62
60
- Example:
63
+ Fetch the tarball url, and then install it. In order to distinguish between
64
+ this and other options, the argument must start with "http://" or "https://"
65
+
66
+ Example:
67
+
68
+ npm install https://github.com/indexzero/forever/tarball/v0.5.6
69
+
70
+ * ` npm install <name> [--save|--save-dev|--save-optional] ` :
71
+
72
+ Do a ` <name>@<tag> ` install, where ` <tag> ` is the "tag" config. (See
73
+ ` npm-config(1) ` .)
61
74
62
- npm install https://github.com/indexzero/forever/tarball/v0.5.6
75
+ In most cases, this will install the latest version
76
+ of the module published on npm.
63
77
64
- * ` npm install <name> ` :
65
- Do a ` <name>@<tag> ` install, where ` <tag> ` is the "tag" config. (See
66
- ` npm-config(1) ` )
78
+ Example:
67
79
68
- Example:
80
+ npm install sax
69
81
70
- npm install sax
82
+ ` npm install ` takes 3 exclusive, optional flags which save or update
83
+ the package version in your main package.json:
71
84
72
- ** Note** : If there is a file or folder named ` <name> ` in the current
73
- working directory, then it will try to install that, and only try to
74
- fetch the package by name if it is not valid.
85
+ * ` --save ` : Package will appear in your ` dependencies ` .
86
+
87
+ * ` --save-dev ` : Package will appear in your ` devDependencies ` .
88
+
89
+ * ` --save-optional ` : Package will appear in your ` optionalDependencies ` .
90
+
91
+ Examples:
92
+
93
+ npm install sax --save
94
+ npm install node-tap --save-dev
95
+ npm install dtrace-provider --save-optional
96
+
97
+
98
+ ** Note** : If there is a file or folder named ` <name> ` in the current
99
+ working directory, then it will try to install that, and only try to
100
+ fetch the package by name if it is not valid.
75
101
76
102
* ` npm install <name>@<tag> ` :
77
- Install the version of the package that is referenced by the specified tag.
78
- If the tag does not exist in the registry data for that package, then this
79
- will fail.
80
103
81
- Example:
104
+ Install the version of the package that is referenced by the specified tag.
105
+ If the tag does not exist in the registry data for that package, then this
106
+ will fail.
107
+
108
+ Example:
82
109
83
- npm install sax@latest
110
+ npm install sax@latest
84
111
85
112
* ` npm install <name>@<version> ` :
86
- Install the specified version of the package. This will fail if the version
87
- has not been published to the registry.
88
113
89
- Example:
114
+ Install the specified version of the package. This will fail if the version
115
+ has not been published to the registry.
90
116
91
-
117
+ Example:
118
+
119
+
92
120
93
121
* ` npm install <name>@<version range> ` :
94
- Install a version of the package matching the specified version range. This
95
- will follow the same rules for resolving dependencies described in ` npm-json(1) ` .
96
122
97
- Note that most version ranges must be put in quotes so that your shell will
98
- treat it as a single argument.
123
+ Install a version of the package matching the specified version range. This
124
+ will follow the same rules for resolving dependencies described in ` npm-json(1) ` .
125
+
126
+ Note that most version ranges must be put in quotes so that your shell will
127
+ treat it as a single argument.
99
128
100
- Example:
129
+ Example:
101
130
102
- npm install sax@">=0.1.0 <0.2.0"
131
+ npm install sax@">=0.1.0 <0.2.0"
103
132
104
133
* ` npm install <git remote url> ` :
105
134
106
- Install a package by cloning a git remote url. The format of the git
107
- url is:
135
+ Install a package by cloning a git remote url. The format of the git
136
+ url is:
108
137
109
- <protocol>://[<user>@]<hostname><separator><path>[#<commit-ish>]
138
+ <protocol>://[<user>@]<hostname><separator><path>[#<commit-ish>]
110
139
111
- ` <protocol> ` is one of ` git ` , ` git+ssh ` , ` git+http ` , or
112
- ` git+https ` . If no ` <commit-ish> ` is specified, then ` master ` is
113
- used.
140
+ ` <protocol> ` is one of ` git ` , ` git+ssh ` , ` git+http ` , or
141
+ ` git+https ` . If no ` <commit-ish> ` is specified, then ` master ` is
142
+ used.
114
143
115
- Examples:
144
+ Examples:
116
145
117
- git+ssh://[email protected] :isaacs/npm.git#v1.0.27
118
- git+https://[email protected] /isaacs/npm.git
119
- git://github.com/isaacs/npm.git#v1.0.27
146
+ git+ssh://[email protected] :isaacs/npm.git#v1.0.27
147
+ git+https://[email protected] /isaacs/npm.git
148
+ git://github.com/isaacs/npm.git#v1.0.27
120
149
121
150
You may combine multiple arguments, and even multiple types of arguments.
122
151
For example:
0 commit comments