Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
npminstall
Advanced tools
Make npm install
fast and handy.
$ npm install npminstall -g
It is integrated in cnpm.
$ npm install cnpm -g
# will use npminstall
$ cnpm install
Usage:
npminstall
npminstall <pkg>
npminstall <pkg>@<tag>
npminstall <pkg>@<version>
npminstall <pkg>@<version range>
npminstall <alias>@npm:<name>
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.
Options:
--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 chinese npm registry and other binary's mirrors
-d, --detail: show detail log of installation
--trace: show memory and cpu usages traces of installation
--ignore-scripts: ignore all preinstall / install and postinstall scripts during the installation
--no-optional: ignore optionalDependencies during the installation
--forbidden-licenses: forbit install packages which used these licenses
--engine-strict: refuse to install (or even consider installing) any package that claims to not be compatible with the current Node.js version.
--flatten: flatten dependencies by matching ancestors dependencies
--registry-only: make sure all packages install from registry. Any package is installed from remote(e.g.: git, remote url) cause install fail.
--cache-strict: use disk cache even on production env
Usage:
npmuninstall <pkg>
npmuninstall <pkg>@<version>
npmuninstall <pkg>@<version> [<pkg>@<version>]
npminstall <alias>@npm:<name>
Usage:
npmlink <folder>
$ npm install npminstall --save
const npminstall = require('npminstall');
(async () => {
await 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 https://registry.npmjs.org
// registry: 'https://registry.npmjs.org',
// debug: false,
// storeDir: root + 'node_modules',
// ignoreScripts: true, // ignore pre/post install scripts, default is `false`
// forbiddenLicenses: forbit install packages which used these licenses
});
})().catch(err => {
console.error(err);
});
npm install file:eslint-rule
)npm install ./rule.tgz
)npm install https://github.com/indexzero/forever/tarball/v0.5.6
)npm install git://github.com/timaschew/cogent#fix-redirects
)-g, --global
)preinstall
, install
, postinstall
scripts--production
modesave
, save-dev
, save-optional
ignore-scripts
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.
npminstall
will collect all postinstall scripts, and execute them until all dependencies installed.node_modules
directoryTwo rules:
options.storeDir
's node_modules
.node_modules
.e.g.:
{ "dependencies": { "debug": "2.2.0" } }
(root){ "dependencies": { "ms": "0.7.1" } }
app/
├── package.json
└── node_modules
├── _debug@2.2.0@debug
│ ├── node_modules
│ │ └── ms -> ../../_ms@0.7.1@ms
├── _ms0.7.1@ms
├── debug -> _debug@2.2.0@debug
└── ms -> _ms@0.7.1@ms # for peerDependencies
npminstall will always try to install the maximal matched version of semver:
root/
koa@1.1.0
mod/
koa@~1.1.0
# will install two different version of koa when use npminstall.
you can enable flatten mode by --flatten
flag, in this mod, npminstall will try to use ancestors' dependencies to minimize the dependence-tree.
root/
koa@1.1.0
mod/
koa@~1.1.0
root/
koa@1.1.0
mod/
koa@^1.1.0
# both the same version: 1.1.0
root/
koa@~1.1.0
mod/
koa@^1.1.0
# both the same version: 1.1.2
root/
mod/
koa@^1.1.0
moe/
koa@~1.1.0
# two different versions
npminstall will always treat n.x
and n.m.x
as flattened
root/
koa@1.1.0
mod/
koa@1.1.x
both the same version: 1.1.0
root/
koa@~1.1.0
mod/
koa@1.x
both the same version: 1.1.2
support selective version resolutions like yarn. which lets you define custom package versions inside your dependencies through the resolutions field in your package.json
file.
resolutions 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.
see use case at unittest package.json.
https://github.com/cnpm/npminstall-benchmark
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 |
see https://github.com/pnpm/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
This project follows the git-contributor spec, auto updated at Wed Nov 09 2022 14:41:07 GMT+0800
.
7.0.0 (2023-01-01)
features
4286740
] - feat: update npm-related deps (#426) (Ke Wu <gemwuu@163.com>)fixes
304a579
] - 🐛 FIX: Custom lookup on httpclient (#425) (fengmk2 <fengmk2@gmail.com>)features
f720eff
] - feat: add dns cache (#424) (Ke Wu <gemwuu@163.com>)fixes
8170ce2
] - fix: pick fix parallel install from local directory (#398)
(#412) (#421) (vagusX <vagusX@users.noreply.github.com>)others
0d880c6
] - 📦 NEW: Use urllib@3 (#407) (fengmk2 <fengmk2@gmail.com>)features
91ced98
] - feat: save dep with tag if install with tag (#408) (killa <killa123@126.com>)others
3787df9
] - 👌 IMPROVE: Remove mz modules deps (#405) (fengmk2 <fengmk2@gmail.com>)others
ce04b97
] - 🐛 FIX: Remove disk cache when version not found (#404) (fengmk2 <fengmk2@gmail.com>)dbceaee
] - deps: Security upgrade pacote from 11.3.5 to 13.0.0 (#402) (fengmk2 <fengmk2@gmail.com>)features
dad3dcf
] - feat: add download url and size for ShasumNotMatchError (#400) (killa <killa123@126.com>)others
f692927
] - 🤖 TEST: CI add Node.js 18 (#397) (fengmk2 <fengmk2@gmail.com>)1364e29
] - 🤖 TEST: Run action on 5.x (fengmk2 <fengmk2@gmail.com>)others
c05046a
] - 📦 NEW: Support override custom scripts on bug-versions (#393) (fengmk2 <fengmk2@gmail.com>)d760c2b
] - chore: update contributors (fengmk2 <fengmk2@gmail.com>)features
0dc0f9e
] - feat: upgrade node-gyp@9 to support python3 (#392) (fengmk2 <fengmk2@gmail.com>)others
161d297
] - Revert "feat: upgrade node-gyp@8 to support python3 (#385)" (#391) (fengmk2 <fengmk2@gmail.com>)fixes
9a60297
] - fix: use pacote@^11 for Node.js@^10 (#390) (Ke Wu <gemwuu@163.com>)others
b220ec3
] - 🐛 FIX: Reduce http request retry warning message log (#389) (fengmk2 <fengmk2@gmail.com>)features
d02fa24
] - feat: upgrade node-gyp@8 to support python3 (#385) (Eason <tobewhatwewant@gmail.com>)others
d58a37b
] - 🐛 FIX: Use detect-libc to get libc family (#388) (fengmk2 <fengmk2@gmail.com>)others
a34f2b4
] - 📦 NEW: Support libc field on conditions install (#387) (fengmk2 <fengmk2@gmail.com>)others
6e2d051
] - 📦 NEW: Support manifests cache control (#383) (fengmk2 <fengmk2@gmail.com>)ead249f
] - chore: Add license scan report and status (#381) (fossabot <badges@fossa.io>)3aa8295
] - 📖 DOC: Use git-contributor instead (fengmk2 <fengmk2@gmail.com>)fixes
2026a73
] - fix: skip pruneJSON when package.json file not exists (#378) (fengmk2 <fengmk2@gmail.com>)69fa07a
] - fix: npminstall multi-registry options (#377) (Ink <chceyes@gmail.com>)others
2622607
] - test: Create codeql-analysis.yml (#379) (fengmk2 <fengmk2@gmail.com>)features
a05e1fa
] - feat: add/remove dependency info from package.json by default (#348) (Homyee King <HomyeeKing@gmail.com>)others
9dbcde4
] - docs: update contributors (#376) (Suyi <thonatos.yang@gmail.com>)fixes
160217d
] - fix: use ora 4.0.5 to support node 8 (#374) (fengmk2 <fengmk2@gmail.com>)others
94a192d
] - deps: upgrade ora@5 for security (#373) (fengmk2 <fengmk2@gmail.com>)21bb03a
] - test: skip fail tests on Windows (#372) (fengmk2 <fengmk2@gmail.com>)48737ad
] - deps: fix http-proxy security (fengmk2 <fengmk2@gmail.com>)46e9357
] - chore: add 96px width badge image (fengmk2 <fengmk2@gmail.com>)4389560
] - chore: use badges service (fengmk2 <fengmk2@gmail.com>)fixes
7859046
] - fix: use pacote to install git repo deps (#370) (Ke Wu <gemwuu@163.com>)5e633bd
] - fix: local_install with default param context (Emma.ou <1061344584@qq.com>)others
b7bd336
] - chore: update contributors (fengmk2 <fengmk2@gmail.com>)fixes
d37416f
] - fix: do fixBin
in windows (#367) (vagusX <vagusX@users.noreply.github.com>)features
202c9fe
] - feat: support windows shebang (#366) (vagusX <vagusX@users.noreply.github.com>)fixes
bca0b88
] - fix: streamingTimeout not work on tar download (#362) (fengmk2 <fengmk2@gmail.com>)others
de255f2
] - test: run node 16 (#360) (fengmk2 <fengmk2@gmail.com>)fixes
3d170c2
] - fix: should check cpu on process.arch too (#359) (fengmk2 <fengmk2@gmail.com>)others
451b1a2
] - chore: fix tag to latest (fengmk2 <fengmk2@gmail.com>)features
11589da
] - feat: add resolutions alias support (#354) (Ke Wu <gemwuu@163.com>)e8bd485
] - feat: migrate to github actions (#355) (Ke Wu <gemwuu@163.com>)others
ac7feaa
] - add skip download logic (#357) (Solais <924615994@qq.com>)fixes
6166be2
] - fix: make npa error more clear (#352) (Ke Wu <gemwuu@163.com>)fixes
1e365c8
] - fix: fix save alias error (#346) (Ke Wu <gemwuu@163.com>)features
ded46fe
] - feat: support npm alias (#341) (Ke Wu <gemwuu@163.com>)6cc5548
] - feat: upgrade npm-package-arg to v8 (#344) (Ke Wu <gemwuu@163.com>)others
1a0aee2
] - chore: exports local_install/runPostInstallTasks function (#338) (Ke Wu <gemwuu@163.com>)features
d598f9d
] - feat: support npm_config_cache to change default cache dir (#335) (fengmk2 <fengmk2@gmail.com>)fixes
f87d6bd
] - fix: replace in files when replaceHostRegExpMap is set (#331) (fengmk2 <fengmk2@gmail.com>)fixes
1320f30
] - fix: install local folder use npm pack (#330) (Yiyu He <dead_horse@qq.com>)features
d586566
] - feat: keep npminstall_done label stable (#329) (Yiyu He <dead_horse@qq.com>)features
58ab908
] - feat: support script.prepare (#328) (Yiyu He <dead_horse@qq.com>)features
9a2dde5
] - feat: support npm_config_user_agent env (#323) (fengmk2 <fengmk2@gmail.com>)features
2a61ab6
] - feat: support INIT_CWD env (#321) (fengmk2 <fengmk2@gmail.com>)fixes
2054f10
] - fix: the vulnerabilities same as npm cli (#319) (fengmk2 <fengmk2@gmail.com>)fixes
e0be08b
] - fix: dont add quotes on node global bin path on Windows (#317) (fengmk2 <fengmk2@gmail.com>)others
bbf4ec1
] - deps: cmd-shim v3 (#315) (fengmk2 <fengmk2@gmail.com>)features
014bbd5
] - feat: support custom scope registry (hugohua <baofen14787@gmail.com>)others
8c00128
] - test: add node 13 (#312) (fengmk2 <fengmk2@gmail.com>)features
4c918ac
] - feat: add force-link-latest mode (#310) (Khaidi Chu <i@2333.moe>)features
32d1c95
] - feat: try to use cypress new platforms (#307) (fengmk2 <fengmk2@gmail.com>)fixes
085c458
] - fix: prune don't filter ts files (#304) (fengmk2 <fengmk2@gmail.com>)features
48bbb04
] - feat: use more faster cdn registry (#303) (fengmk2 <fengmk2@gmail.com>)fixes
2688fa8
] - fix: cnpm install error without user settings (#301) (M0D27 <i@0u0b.com>)others
fe32958
] - test: use async/await instead of generator (fengmk2 <fengmk2@gmail.com>)3fbb871
] - refactor: use p-map instead of co-parallel (fengmk2 <fengmk2@gmail.com>)313dcb9
] - refactor: use async/await instead of generator function (fengmk2 <fengmk2@gmail.com>)322c5e0
] - refactor: drop node 4 and 6 support (fengmk2 <fengmk2@gmail.com>)ef1432a
] - chore: remove benchmark (#298) (fengmk2 <fengmk2@gmail.com>)f867120
] - chore: add publishConfig.tag latest-3 (fengmk2 <fengmk2@gmail.com>)features
4464362
] - feat: support authorization (#259) (hyj1991 <yeekwanvong@gmail.com>)others
c41abc0
] - chore: typo (#295) (vuchan <givingwu@gmail.com>)fixes
8dc3842
] - fix: --client override --prodcution (#294) (Yiyu He <dead_horse@qq.com>)fixes
8f558a5
] - fix: resolutions support scope packages (#292) (Yiyu He <dead_horse@qq.com>)features
9aa0a65
] - feat: support selective version resolutions (#291) (Yiyu He <dead_horse@qq.com>)fixes
0975790
] - fix: show every runscript log before run it (#290) (fengmk2 <fengmk2@gmail.com>)features
b702924
] - feat: show post isntall scripts error detail message (#289) (fengmk2 <fengmk2@gmail.com>)features
d029138
] - feat: support dependencies tree (#287) (Yiyu He <dead_horse@qq.com>)features
45bdbc0
] - feat: support binary mirror replaceHostFiles config (#285) (fengmk2 <fengmk2@gmail.com>)fixes
20bbb17
] - fix: try to link latest version to top node_modules (#284) (fengmk2 <fengmk2@gmail.com>)others
e7f1f05
] - docs: typo chinses -> chinese (#283) (孑枵 <Abreto@users.noreply.github.com>)features
1c74e7d
] - feat: support --no-optional on install process (#282) (fengmk2 <fengmk2@gmail.com>)features
8f94a43
] - feat: support install clientDependencies / buildDependencies / isomorphicDependencies (#281) (Yiyu He <dead_horse@qq.com>)features
a472b39
] - feat: set config per env (#280) (fengmk2 <fengmk2@gmail.com>)features
a36dd1c
] - feat: allow disable dedupe mode on node project (#279) (fengmk2 <fengmk2@gmail.com>)others
e15b7e3
] - bench: update ghost package.json (fengmk2 <fengmk2@gmail.com>)features
ef75b34
] - feat: replace vscode raw.gitcontent.com url (#278) (fengmk2 <fengmk2@gmail.com>)others
05a31ee
] - refactor: don't create .npminstall.done file (#277) (fengmk2 <fengmk2@gmail.com>)features
89f48cc
] - feat: support high speed store for tarball download (#276) (fengmk2 <fengmk2@gmail.com>)fixes
68b4ea8
] - fix: don't remove gulpfile (#275) (Wei Zhu <yesmeck@gmail.com>)fixes
fed1d7b
] - fix: don't prune assets dir (#274) (Wei Zhu <yesmeck@gmail.com>)features
1879801
] - feat: enable prune unused files by --prune option (#273) (fengmk2 <fengmk2@gmail.com>)features
cebc8e7
] - feat: download cypress from mirrors (#270) (fengmk2 <fengmk2@gmail.com>)features
b486e06
] - feat: support download tarball from other_urls query params (#269) (fengmk2 <fengmk2@gmail.com>)fixes
19d1545
] - fix: should support contains querystring registry (#268) (fengmk2 <fengmk2@gmail.com>)fixes
36c115d
] - fix: should keep querystring on registry url (#267) (fengmk2 <fengmk2@gmail.com>)features
b140b50
] - feat: support auto fix bug dependencies (#266) (fengmk2 <fengmk2@gmail.com>)features
1b5be21
] - feat: support latest-{major} tag as latest version (fengmk2 <fengmk2@gmail.com>)others
bb395a5
] - test: add node 9 (fengmk2 <fengmk2@gmail.com>)f2b1852
] - chore: fix spelling mistake on README.md (Harry peng <940948813@qq.com>)features
ec0f76c
] - feat: add streamingTimeout for tar.gz download timeout (fengmk2 <fengmk2@gmail.com>)fixes
ff8a48f
] - fix: lock ora@~1.3.0 (fengmk2 <fengmk2@gmail.com>)features
68164ea
] - feat: support auto fix bug version of package (#256) (fengmk2 <fengmk2@gmail.com>)fixes
635d39f
] - fix: handle concurrent install same bin name error (#251) (fengmk2 <fengmk2@gmail.com>)features
aeaf2fb
] - feat: support mirror prebuild-install package (#250) (fengmk2 <fengmk2@gmail.com>)fixes
297260c
] - fix: ignore warnning node_modules on [ '.bin', 'node' ] dir (#248) (fengmk2 <fengmk2@gmail.com>)fixes
54abccb
] - fix: make sure Buffer.alloc exit on node < 4.5.0 (#247) (fengmk2 <fengmk2@gmail.com>)others
9e6f5fa
] - test: don't clean cache on windows (#246) (fengmk2 <fengmk2@gmail.com>)fixes
87615ef
] - fix: ensure read and write permission like npm (#245) (Yiyu He <dead_horse@qq.com>)others
5ea123d
] - chore: update pnpm links (#244) (Lon <cnlon@users.noreply.github.com>)_{name}
(#223)npmlink
=> npm link
to global (#172)$ npmlink <folder>
(#169)~/foo/path
(#146)npm_package_*
env on run script (#116)node_modules
(#99)npm_config_
env prefix namePath
env on WindowsFAQs
Make npm install fast and handy.
The npm package npminstall receives a total of 12,936 weekly downloads. As such, npminstall popularity was classified as popular.
We found that npminstall demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.