The npm install -s flag explained

When installing packages from npm, you may see the -s flag added to the npm install command as follows:

npm install -s

The -s flag is a shorthand for the silent configuration, which sets the log level of your npm installation process to nothing.

The following Terminal commands are all equal:

npm install -s
npm install --silent
npm install --loglevel silent

When you install npm packages using the -s flag, then npm won’t log any output to the console. You won’t be able to know whether the installation is successful or not from the Terminal.

A regular npm install command will show the following output:

$ npm install react

added 4 packages, and audited 17 packages in 2s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
$

While npm install with the -s flag will show no output at all:

$ npm install vue -s
$

To know if your installation is successful, you need to open the package.json file and see if the package name is listed as dependencies.

Alternatively, you can open the node_modules/ folder and check if a folder with the package name exists there.

Keep in mind that the npm command flag is case-sensitive. The lower case -s flag is used to set the log level mode to silent, while the upper case -S flag is used to save installed packages to a package.json file as dependencies.

The npm save configuration has been set to true by default since npm version 5.

Take your skills to the next level ⚡️

I'm sending out an occasional email with the latest tutorials on programming, web development, and statistics. Drop your email in the box below and I'll send new stuff straight into your inbox!

No spam. Unsubscribe anytime.