Let npm install fast and easy
Last updated 2 years ago by fengmk2 .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install npminstall-1 
SYNC missed versions from official npm registry.


NPM version build status appveyor build status Test coverage David deps Known Vulnerabilities npm download

Let npm install fast and easy.

Use as Cli


$ npm install npminstall --g




  npminstall <pkg>
  npminstall <pkg>@<tag>
  npminstall <pkg>@<version>
  npminstall <pkg>@<version range>
  npminstall <folder>
  npminstall <tarball file>
  npminstall <tarball url>
  npminstall <git:// url>
  npminstall <github username>/<github project>

Can specify one or more: npm install ./foo.tgz bar@stable /some/folder
If no argument is supplied, installs dependencies from ./package.json.


  --production: won't install devDependencies
  --save, --save-dev, --save-optional: save installed dependencies into package.json
  -g, --global: install devDependencies to global directory which specified in '$ npm config get prefix'
  -r, --registry: specify custom registry
  -c, --china: specify in china, will automatically using chinses npm registry and other binary's mirrors
  --ignore-scripts: ignore all preinstall / install and postinstall scripts during the installation
  --forbidden-licenses: forbit install packages which used these licenses



  npmuninstall <pkg>
  npmuninstall <pkg>@<version>
  npmuninstall <pkg>@<version> [<pkg>@<version>]

Use as Lib


$ npm install npminstall --save


const co = require('co');
const npminstall = require('npminstall');

co(function*() {
  yield npminstall({
    // install root dir
    root: process.cwd(),
    // optional packages need to install, default is package.json's dependencies and devDependencies
    // pkgs: [
    //   { name: 'foo', version: '~1.0.0' },
    // ],
    // install to specific directory, default to root
    // targetDir: '/home/admin/.global/lib',
    // link bin to specific directory (for global install)
    // binDir: '/home/admin/.global/bin',
    // registry, default is
    // registry: '',
    // debug: false,
    // storeDir: root + '.npminstall',
    // ignoreScripts: true, // ignore pre/post install scripts, default is `false`
    // forbiddenLicenses: forbit install packages which used these licenses
}).catch(function(err) {

Support Features

  • [x] all types of npm package
    • [x] a) a folder containing a program described by a package.json file (npm install file:eslint-rule)
    • [x] b) a gzipped tarball containing (a) (npm install ./rule.tgz)
    • [x] c) a url that resolves to (b) (npm install
    • [x] d) a <name>@<version> that is published on the registry with (c)
    • [x] e) a <name>@<tag> (see npm-dist-tag) that points to (d)
    • [x] f) a <name> that has a "latest" tag satisfying (e)
    • [x] g) a <git remote url> that resolves to (a) (npm install git://
  • [x] All platform support
  • [x] global install (-g, --global)
  • [x] preinstall, install, postinstall scripts
  • [x] node-gyp
    • [x] node-pre-gyp
  • [x] bin (yo@1.6.0, fsevents@1.0.6)
  • [x] scoped package
  • [x] bundleDependencies / bundledDependencies (node-pre-gyp@0.6.19, fsevents@1.0.6)
  • [x] optionalDependencies (pm2@1.0.0)
  • [x] peerDependencies (co-defer@1.0.0, co-mocha@1.1.2, estraverse-fb@1.3.1)
  • [x] deprecate message
  • [x] --production mode
  • [x] save, save-dev, save-optional
  • [x] support ignore-scripts
  • [x] uninstall

Different with NPM

This project is inspired by pnpm, and has a similar store structure like pnpm. You can read pnpm vs npm to see the different with npm.


  • You can't install from shrinkwrap(and don't want to support for now).
  • Peer dependencies are a little trickier to deal with(see rule 1 below).
  • You can't publish npm modules with bundleDependencies managed by npminstall(because of rule 2 below).
  • npminstall will collect all postinstall scripts, and execute them until all dependencies installed.
  • If last install failed, better to cleanup node_modules directory before retry.

node_modules directory

Two rules:

  1. The latest version of modules will link at options.storeDir's node_modules.
  2. Module's dependencies will link at module's node_modules.


  • app: { "dependencies": { "debug": "2.2.0" } } (root)
  • debug@2.2.0: { "dependencies": { "ms": "0.7.1" } }
├── package.json
└── node_modules/
    ├── .npminstall/
    │   ├── debug/
    │   │   └── 2.2.0/
    │   │       └── debug
    │   │           ├── package.json
    │   │           └── node_modules/
    │   │               └── ms -> ../../../../ms/0.7.1/ms
    │   ├── ms/
    │   │   └── 0.7.1/
    │   │       └── ms
    │   │           └── package.json
    │   └── node_modules/
    │       └── ms -> ../ms/0.7.1/ms
    └── debug -> .npminstall/debug/2.2.0/debug

debug@2.2.0 is root package, won't create link at app/node_modules/.npminstall/node_modules/debug@.

Benchmarks install

  • npminstall@1.2.0
  • pnpm@0.18.0
  • npm@2.14.12
cli real user sys
npminstall 0m10.908s 0m8.733s 0m4.282s
npminstall with cache 0m8.815s 0m7.492s 0m3.644s
npminstall --no-cache 0m10.279s 0m8.255s 0m3.932s
pnpm 0m13.509s 0m11.650s 0m4.443s
npm 0m28.171s 0m26.085s 0m8.219s
npm with cache 0m20.939s 0m19.415s 0m6.302s

pnpm benchmark


npminstall babel-preset-es2015 browserify chalk debug minimist mkdirp
    real	0m8.929s       user	0m5.606s       sys	0m2.913s
pnpm i babel-preset-es2015 browserify chalk debug minimist mkdirp
    real	0m12.998s      user	0m8.653s       sys	0m3.362s
npm i babel-preset-es2015 browserify chalk debug minimist mkdirp
    real	1m4.729s       user	0m55.589s      sys	0m23.135s



Maintainers (1)
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 1
Last Month 7
Dependencies (24)
Dependents (0)

Copyright 2014 - 2016 © |