npm-install-package

Install an npm package

Usage no npm install needed!

<script type="module">
  import npmInstallPackage from 'https://cdn.skypack.dev/npm-install-package';
</script>

README

npm-install-package

NPM version build status Test coverage Downloads js-standard-style

Install an npm package.

Installation

$ npm install npm-install-package

Usage

var install = require('npm-install-package')

install('minimist', function (err) {
  if (err) throw err
})

With multiple installs, offline-first fetching and saving to dev dependencies:

var install = require('npm-install-package')

var devDeps = [ 'map-limit', 'minimist', 'cliclopts' ]
var opts = { saveDev: true, cache: true }

install(devDeps, opts, function (err) {
  if (err) throw err
})

API

install(dependencies, options, cb)

Install an array of dependencies. Opts can contain the following values:

  • save: save a value to dependencies. Defaults to false
  • saveDev: save a value to devDependencies. Defaults to false
  • cache: attempt to get packages from the local cache first. Defaults to false
  • silent: install packages silently without writing to stdout. Defaults to false

License

MIT