$ npm install cnpm -g
# will use npminstall
$ cnpm install
npminstall
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 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.
--cache-strict: use disk cache even on production env
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
flattened vs nested
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
Resolutions
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. It's a workaround feature to fix some archived/inactive/ package by uploading your own bug-fixed version to npm registry.
The npm package npminstall receives a total of 2,643 weekly downloads. As such, npminstall popularity was classified as popular.
We found that npminstall demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 6 open source maintainers collaborating on the project.
Package last updated on 18 Dec 2023
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.
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.