The goal is to only populate the npm cache. This goal arises from the need to prime restrictive build environments without access to an npm registry after initial setup.
Is there a way to make npm cache add <name>@<version>
include dependencies?
For example:
npm cache add [email protected]
creates only karma in the cache foldernpm install [email protected];rm -rf node_modules
creates karma and all its dependencies in the cache folder but requires removal of locally installed node_modulesIn example two, executing npm install [email protected] --no-registry
works without issue as hoped. Is it possible to avoid the extra steps of creating and then deleting local node_modules in order to populate the cache?
Generate npm-shrinkwrap.json: npm shrinkwrap --dev
Install and execute cache-shrinkwrap
Delete resolved keys from shrinkwrap.json
Add npm-shrinkwrap.json to source control with your project to guarantee only cached versions will be requested when npm install --no-registry
is executed in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With