{"name":"npminstall","version":"8.0.1","description":"Make npm install fast and handy.","main":"lib/index.js","bin":{"npminstall":"bin/install.js","npmlink":"bin/link.js","npmuninstall":"bin/uninstall.js","npmupdate":"bin/update.js"},"scripts":{"test":"npm run lint && egg-bin test -t 2000000 -p","test-local":"npm run test-local-single -- -p","test-local-single":"npm run clean && npm_china=true local=true egg-bin test -t 2000000","cov":"egg-bin cov -t 2000000","cov-debug":"cross-env NODE_DEBUG=npminstall* egg-bin cov -t 2000000","lint":"eslint . --fix","ci":"npm run lint && npm run cov","clean":"rm -rf test/fixtures/.tmp*"},"dependencies":{"@npmcli/arborist":"^9.1.9","@zkochan/cmd-shim":"^5.4.0","await-event":"^2.1.0","bin-links":"^2.3.0","binary-mirror-config":"^1.19.0","bug-versions":"^1.90.0","bytes":"^3.1.0","cacheable-lookup":"^6.1.0","chalk":"^2.4.2","destroy":"^1.0.4","detect-libc":"^2.0.1","execa":"^5.1.1","fs-extra":"^7.0.1","globby":"^11.1.0","minimatch":"^3.0.4","minimist":"^1.2.0","moment":"^2.24.0","ms":"^2.1.1","node-gyp":"^12.1.0","node-homedir":"^1.1.1","normalize-package-data":"^5.0.0","npm-normalize-package-bin":"^3.0.0","npm-package-arg":"^8.1.5","ora":"^4.0.5","p-map":"^2.1.0","pacote":"^21.0.4","rc":"^1.2.8","semver":"^7.0.0","tar":"^7.5.3","urllib":"^4.9.0"},"devDependencies":{"assert-file":"^1.0.0","coffee":"^5.5.0","cross-env":"^7.0.3","egg-bin":"^6.13.0","eslint":"^8.31.0","eslint-config-egg":"^12.1.0","mm":"^3.2.1"},"homepage":"https://github.com/cnpm/npminstall","repository":{"type":"git","url":"git://github.com/cnpm/npminstall.git"},"bugs":{"url":"https://github.com/cnpm/npminstall/issues"},"publishConfig":{"tag":"latest"},"keywords":["npminstall","npm install","yarn","pnpm","fastest npm install"],"engines":{"node":">=20.0.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},"license":"MIT","gitHead":"aaf25fd65b679e422d019b7c19e515c7d3173052","_id":"npminstall@8.0.1","_nodeVersion":"24.12.0","_npmVersion":"11.7.0","dist":{"integrity":"sha512-rU4xlWcAys0I9GiG0VhWLPuYjH4pR8R1BEtC6bjl1yWMiLQ9JVxXyxKr8gokQypo4Z1iiSRsXGZgbU7cdThrYw==","shasum":"3a25ece35eaa06bdbc222c9da55418f239f66c1a","tarball":"http://registry-npm.ywwl.com/npminstall/download/npminstall-8.0.1.tgz","fileCount":36,"unpackedSize":169612,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/npminstall@8.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBkSmKprbWBMiktheiZvORb6Fr+DzzWKQ2Up047/il8kAiEAoIpowC31Rj++gPhgWCAZYlXd6Sc1s2P50qf3kLrew78="}],"size":46250,"noattachment":false,"key":"/npminstall/-/npminstall-8.0.1.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:bc946bc5-f7bf-4553-b2eb-62db09a2bf90"}},"directories":{},"maintainers":[{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"elrrrrrrr","email":"elrrrrrrr@gmail.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"hyj1991","email":"yeekwanvong@gmail.com"},{"name":"killagu","email":"killa07071201@gmail.com"},{"name":"gemwuu","email":"gemwuu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/npminstall_8.0.1_1768917497362_0.3342801622106977"},"_hasShrinkwrap":false,"readme":"# npminstall\n\n[![NPM version][npm-image]][npm-url]\n[![Node CI](https://github.com/cnpm/npminstall/actions/workflows/ci.yml/badge.svg)](https://github.com/cnpm/npminstall/actions/workflows/ci.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcnpm%2Fnpminstall.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcnpm%2Fnpminstall?ref=badge_shield)\n\n[npm-image]: https://img.shields.io/npm/v/npminstall.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/npminstall\n[codecov-image]: https://codecov.io/gh/cnpm/npminstall/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/cnpm/npminstall\n[snyk-image]: https://snyk.io/test/npm/npminstall/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/npminstall\n[download-image]: https://img.shields.io/npm/dm/npminstall.svg?style=flat-square\n[download-url]: https://npmjs.org/package/npminstall\n\nMake `npm install` fast and handy.\n\n## Node.js and Python required\n\n- Node.js >= 20.x\n- Python >= 3.x\n\n## Use as Cli\n\n### Install\n\n```bash\n$ npm i -g npminstall\n```\n\n### Usage\n\n#### In cnpm\n\nIt is integrated in [cnpm](https://github.com/cnpm/cnpm).\n\n```bash\n$ npm i -g cnpm\n# will use npminstall\n$ cnpm install\n```\n\n#### npminstall\n\n```bash\nUsage:\n\n  npminstall\n  npminstall <pkg>\n  npminstall <pkg>@<tag>\n  npminstall <pkg>@<version>\n  npminstall <pkg>@<version range>\n  npminstall <alias>@npm:<name>\n  npminstall <folder>\n  npminstall <tarball file>\n  npminstall <tarball url>\n  npminstall <git:// url>\n  npminstall <github username>/<github project>\n\nCan specify one or more: npm install ./foo.tgz bar@stable /some/folder\nIf no argument is supplied, installs dependencies from ./package.json.\n\nOptions:\n\n  --production: won't install devDependencies\n  --save, --save-dev, --save-optional: save installed dependencies into package.json\n  -g, --global: install devDependencies to global directory which specified in `$ npm config get prefix`\n  -r, --registry: specify custom registry\n  -c, --china: specify in china, will automatically using chinese npm registry and other binary's mirrors\n  -d, --detail: show detail log of installation\n  --trace: show memory and cpu usages traces of installation\n  --ignore-scripts: ignore all preinstall / install and postinstall scripts during the installation\n  --no-optional: ignore optionalDependencies during the installation\n  --forbidden-licenses: forbit install packages which used these licenses\n  --engine-strict: refuse to install (or even consider installing) any package that claims to not be compatible with the current Node.js version.\n  --flatten: flatten dependencies by matching ancestors dependencies\n  --registry-only: make sure that all packages are installed from registry. Any package that is installed from remote(e.g.: git, remote url) will lead to a failure of installation.\n  --cache-strict: use disk cache even on production env\n```\n\n#### npmuninstall\n\n```bash\nUsage:\n\n  npmuninstall <pkg>\n  npmuninstall <pkg>@<version>\n  npmuninstall <pkg>@<version> [<pkg>@<version>]\n  npminstall <alias>@npm:<name>\n```\n\n#### npmlink\n\n```bash\nUsage:\n\n  npmlink <folder>\n```\n\n## Use as Lib\n\n### Install\n\n```bash\n$ npm install npminstall --save\n```\n\n### Usage\n\n```js\nconst npminstall = require('npminstall');\n\n(async () => {\n  await npminstall({\n    // install root dir\n    root: process.cwd(),\n    // optional packages need to install, default is package.json's dependencies and devDependencies\n    // pkgs: [\n    //   { name: 'foo', version: '~1.0.0' },\n    // ],\n    // install to specific directory, default to root\n    // targetDir: '/home/admin/.global/lib',\n    // link bin to specific directory (for global install)\n    // binDir: '/home/admin/.global/bin',\n    // registry, default is https://registry.npmjs.org\n    // registry: 'https://registry.npmjs.org',\n    // debug: false,\n    // storeDir: root + 'node_modules',\n    // ignoreScripts: true, // ignore pre/post install scripts, default is `false`\n    // forbiddenLicenses: forbit install packages which used these licenses\n  });\n})().catch(err => {\n  console.error(err);\n});\n```\n\n## Support Features\n\n- [x] all types of npm package\n  - [x] a) a folder containing a program described by a package.json file (`npm install file:eslint-rule`)\n  - [x] b) a gzipped tarball containing (a) (`npm install ./rule.tgz`)\n  - [x] c) a url that resolves to (b) (`npm install https://github.com/indexzero/forever/tarball/v0.5.6`)\n  - [x] d) a <name>@<version> that is published on the registry with (c)\n  - [x] e) a <name>@<tag> (see npm-dist-tag) that points to (d)\n  - [x] f) a <name> that has a \"latest\" tag satisfying (e)\n  - [x] g) a <git remote url> that resolves to (a) (`npm install git://github.com/timaschew/cogent#fix-redirects`)\n- [x] All platform support\n- [x] global install (`-g, --global`)\n- [x] `preinstall`, `install`, `postinstall` scripts\n- [x] node-gyp@9, only support Python@3\n  - [x] node-pre-gyp\n- [x] bin (yo@1.6.0, fsevents@1.0.6)\n- [x] scoped package\n- [x] bundleDependencies / bundledDependencies (node-pre-gyp@0.6.19, fsevents@1.0.6)\n- [x] optionalDependencies (pm2@1.0.0)\n- [x] peerDependencies (co-defer@1.0.0, co-mocha@1.1.2, estraverse-fb@1.3.1)\n- [x] deprecate message\n- [x] `--production` mode\n- [x] `save`, `save-dev`, `save-optional`\n- [x] support `ignore-scripts`\n- [x] uninstall\n- [x] resolutions\n- [x] [npm alias](https://github.com/npm/rfcs/blob/latest/implemented/0001-package-aliases.md)\n- [x] [npm workspaces](https://docs.npmjs.com/cli/v9/using-npm/workspaces?v=true)\n\n## Different with NPM\n\nThis project is inspired by [pnpm](https://github.com/pnpm/pnpm), and has a similar store structure like pnpm. You can read [pnpm vs npm](https://github.com/pnpm/pnpm/blob/master/docs/pnpm-vs-npm.md) to see the different with npm.\n\n### Limitations\n\n- You can't install from [shrinkwrap](https://docs.npmjs.com/cli/shrinkwrap)(and don't want to support for now).\n- Peer dependencies are a little trickier to deal with(see rule 1 below).\n- You can't publish npm modules with bundleDependencies managed by npminstall(because of rule 2 below).\n- `npminstall` will collect all postinstall scripts, and execute them until all dependencies installed.\n- If last install failed, better to cleanup node_modules directory before retry.\n\n## `node_modules` directory\n\nTwo rules:\n\n1. The latest version of modules will link at `options.storeDir`'s `node_modules`.\n2. Module's dependencies will link at module's `node_modules`.\n\ne.g.:\n\n- app: `{ \"dependencies\": { \"debug\": \"2.2.0\" } }` (root)\n- debug@2.2.0: `{ \"dependencies\": { \"ms\": \"0.7.1\" } }`\n\n```bash\napp/\n├── package.json\n└── node_modules\n    ├── _debug@2.2.0@debug\n    │   ├── node_modules\n    │   │   └── ms -> ../../_ms@0.7.1@ms\n    ├── _ms0.7.1@ms\n    ├── debug -> _debug@2.2.0@debug\n    └── ms -> _ms@0.7.1@ms # for peerDependencies\n```\n\n### flattened vs nested\n\nnpminstall will always try to install the maximal matched version of semver:\n\n```\nroot/\n  koa@1.1.0\n  mod/\n    koa@~1.1.0\n# will install two different version of koa when use npminstall.\n```\n\nyou can enable flatten mode by `--flatten` flag, in this mod, npminstall will try to use ancestors' dependencies to minimize the dependence-tree.\n\n```\nroot/\n  koa@1.1.0\n  mod/\n    koa@~1.1.0\n\nroot/\n  koa@1.1.0\n  mod/\n    koa@^1.1.0\n# both the same version: 1.1.0\n\nroot/\n  koa@~1.1.0\n  mod/\n    koa@^1.1.0\n# both the same version: 1.1.2\n\nroot/\n  mod/\n    koa@^1.1.0\n  moe/\n    koa@~1.1.0\n# two different versions\n```\n\n**npminstall will always treat `n.x` and `n.m.x` as flattened**\n\n```\nroot/\n  koa@1.1.0\n  mod/\n    koa@1.1.x\nboth the same version: 1.1.0\n\nroot/\n  koa@~1.1.0\n  mod/\n    koa@1.x\nboth the same version: 1.1.2\n```\n\n## Resolutions\n\nsupport [selective version resolutions](https://yarnpkg.com/en/docs/selective-version-resolutions) like yarn. which lets you define custom package versions inside your dependencies through the resolutions field in your `package.json` file.\n\nresolutions also supports [npm alias](https://docs.npmjs.com/cli/v7/commands/npm-install). It's a workaround feature to fix some archived/inactive/ package by uploading your own bug-fixed version to npm registry.\n\nsee use case at [unittest package.json](./test/fixtures/resolutions-alias/package.json).\n\n## Benchmarks\n\nhttps://github.com/cnpm/npminstall-benchmark\n\n### cnpmjs.org install\n\n- npminstall@1.2.0\n- pnpm@0.18.0\n- npm@2.14.12\n\ncli | real | user | sys\n--- | ---  | ---  | ---\nnpminstall | 0m10.908s | 0m8.733s | 0m4.282s\nnpminstall with cache | 0m8.815s | 0m7.492s | 0m3.644s\nnpminstall --no-cache | 0m10.279s | 0m8.255s | 0m3.932s\npnpm | 0m13.509s | 0m11.650s | 0m4.443s\nnpm | 0m28.171s | 0m26.085s | 0m8.219s\nnpm with cache | 0m20.939s | 0m19.415s | 0m6.302s\n\n### pnpm benchmark\n\nsee https://github.com/pnpm/pnpm#benchmark\n\n```bash\nnpminstall babel-preset-es2015 browserify chalk debug minimist mkdirp\n    real\t0m8.929s       user\t0m5.606s       sys\t0m2.913s\n```\n\n```bash\npnpm i babel-preset-es2015 browserify chalk debug minimist mkdirp\n    real\t0m12.998s      user\t0m8.653s       sys\t0m3.362s\n```\n\n```bash\nnpm i babel-preset-es2015 browserify chalk debug minimist mkdirp\n    real\t1m4.729s       user\t0m55.589s      sys\t0m23.135s\n```\n\n## License\n\n[MIT](LICENSE.txt)\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=cnpm/npminstall)](https://github.com/cnpm/npminstall/graphs/contributors)\n\nMade with [contributors-img](https://contrib.rocks).\n","publish_time":1768917497493,"_cnpm_publish_time":1768917497493,"dist-tags":{"beta":"7.7.0","latest":"8.0.1","latest-1":"1.16.0","latest-2":"2.31.0","latest-3":"3.28.1","latest-4":"4.11.0","latest-5":"5.8.1","latest-6":"6.8.0"}}