![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
npminstall
Advanced tools
Let npm install
fast and easy.
$ npm install npminstall --g
Usage:
npminstall
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.
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 chinses npm registry and other binary's mirrors
--ignore-scripts: ignore all preinstall / install and postinstall scripts during the installation
$ 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 https://registry.npmjs.org
// registry: 'https://registry.npmjs.org',
// debug: false,
// storeDir: root + '.npminstall',
// ignoreScripts: true, // ignore pre/post install scripts, default is `false`
});
}).catch(function(err) {
console.error(err.stack);
});
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/
├── .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@
.
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/rstacruz/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
FAQs
Make npm install fast and handy.
The npm package npminstall receives a total of 16,421 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.