44

What does the -S flag for npm mean? I see it referenced here but https://docs.npmjs.com/cli/install does not cover what the -S is.

npm i -S @types/google-apps-script
1
  • 6
    Just for completion, if somebody arrived here through searching for -s flag (lowercase s) by flawed search engine results, lowercase s is shortcur for --silent.
    – Volker E.
    Commented Apr 13, 2021 at 13:08

2 Answers 2

65

-S is shorthand for --save, and it adds the package you're installing to the dependencies in your package.json file (which can be created with npm init). However, --save or -S is totally unnecessary if you're using npm 5 or above since it's done by default.

26

The 'S' option is the Save option in npm. It adds the npm package to your dependencies for your project. It's the same as --save.

4
  • Got it. Thank you! I wish the documentation clearly stated that shorthand somewhere. Commented Sep 4, 2019 at 17:19
  • 14
    "It's the same as --save-dev." -- this is wrong. The shorthand of --save-dev is -D. Also, --save, or -S, is no longer necessary as this is done by default since npm 5. blog.npmjs.org/post/161081169345/v500
    – nCardot
    Commented Oct 20, 2019 at 18:16
  • 1
    what's the reason for using synonym for --save vs -s ? Unnecessary creates confusion
    – vikramvi
    Commented Oct 16, 2020 at 9:49
  • 2
    so you don't have to type as much
    – nCardot
    Commented Aug 18, 2021 at 1:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.