NPM Install
This command installs a package, and any packages that it depends on. If the package has a package-lock or shrinkwrap file, the installation of dependencies will be driven by that, with an
npm-shrinkwrap.json taking precedence if both files exist. See package-lock.json and npm-shrinkwrap.npm install(in package directory, no arguments):Install the dependencies in the local node_modules folder.In global mode (ie, with-gor--globalappended to the command), it installs the current package context (ie, the current working directory) as a global package.By default,npm installwill install all modules listed as dependencies inpackage.json.With the--productionflag (or when theNODE_ENVenvironment variable is set toproduction), npm will not install modules listed indevDependencies.NOTE: The--productionflag has no particular meaning when adding a dependency to a project.npm install <folder>:Install the package in the directory as a symlink in the current project. Its dependencies will be installed before it’s linked. If<folder>sits inside the root of your project, its dependencies may be hoisted to the toplevelnode_modulesas they would for other types of dependencies.npm install <tarball file>:Install a package that is sitting on the filesystem. Note: if you just want to link a dev directory into your npm root, you can do this more easily by usingnpm link.Tarball requirements:- The filename must use
.tar,.tar.gz, or.tgzas the extension. - The package contents should reside in a subfolder inside the tarball (usually it is called
package/). npm strips one directory layer when installing the package (an equivalent oftar x --strip-components=1is run). - The package must contain a
package.jsonfile withnameandversionproperties.
Example:npm install ./package.tgz- The filename must use