The npm install -s flag explained

Learn the meaning behind npm install -s command

Posted on June 25, 2021


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.

Related articles:

Level up your programming skills

I'm sending out an email once every Wednesday with the latest programming tutorials. Drop your email in the box below and I'll send new stuff straight into your inbox!

No spam. Unsubscribe anytime.