npm install multiple package names
The other answers here do not appear to answer the question. Specifically, doing an npm install --save-dev p1 p2 p3
does not cause p2 and p3 to be stored in my package.json
file.
The following line installs all packages + saves it in dev dependencies for me:
for i in 'package1' 'package2'; do npm install --save-dev "$i"; done
I'm on Windows and use Cygwin, but this works on *nix systems, too.
Somewhat unrelated but very important if using Cygwin: if you do use Cygwin, you need to add noacl
to your mount options, or it will mess up your module permissions and cause Windows to freak out.
Save as dependencies:
npm i package1 package2
Save as dev-dependencies:
npm i -D package1 package2
npm i --save-dev package1 package2
npm install -save module1 module2
Example: npm install -save morgan chalk errorhandler lusca dotenv path mongoose
The above command will install the latest versions of morgan, chalk, errorhandler, lusca, dotenv, path and mongoose.
It is definitely not installing multiple packages
Why? You're installing package1 and package2 and marking them as devDependencies
with --save-dev
.
As stated in the documentation, you may combine multiple arguments, and even multiple types of arguments. In your case, you're combining 2 package names published on the registry.