-1

From this answer I learned the importance of creating the file packages.json and putting in requirements for its dependencies. I do understand what the following two commands do and I've seen the effect of them in the file.

npm install require-dir --save-dev  
npm install lodash --save

I'm uncertain of a thing and it's the require-dir part. Is that a reserved word or something like that? Or are we free to use anything in order to create the entries in the packages.json file? Or am I reading it wrong and it's not "require-dir" but rather "require" and "dir" (or "-dir" maybe)?

And that leads me to the second part. I'm confused by the number of dashes in the syntax. Usually I see a single dash everywhere to indicate that something is a flag. E.g. npm install typescript -global. How should I interpret the double dash? Is it an empty flag in front of another flag (like -null-save) but compressed? Is it some kind of escape character?

Community
  • 1
  • 1
  • 3
    That would be `-g` or `--global`, no? This isn't unique to `npm` generally or `install` specifically, you need to read up on using the command line. – jonrsharpe Oct 11 '16 at 21:57

1 Answers1

1

require-dir is a Node helper to require() directories and you are reading it right. Take a look at https://www.npmjs.com/package/require-dir

And for the Two hyphen–minus characters ( -- ) they are generally used on some programs to specify "long options" where more descriptive option names are used. For example, both The -g and --global argument will cause npm to install the package globally

Gg_oT
  • 11
  • 1