Skip to content

πŸ“¦ An example of how to set up npm to point to a local project's cached/mirrored deps

Notifications You must be signed in to change notification settings

darcyclarke/npm-offline-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

πŸ“¦ npm-offline-cache

An example of how to set up a npm project-specific cache/mirror of deps (similar to yarn's offline mode). You can read more about npm-cache @ docs.npmjs.com/cli/cache.

Steps to generate a project-specific cache

  • Create an .npmrc file in your project's root with the following
 # choose a directory were you want to cache your deps
cache = ./npm_cache_mirror
  • Run npm install
  • Your ./npm_cache_mirror directory will now have a cached version of all your deps

Notes

  • If you want to check in this cache (which is somewhat expected) ensure you also check in your package-lock.json or npm-shrinkwrap.json files to ensure everything gets properly resolved
  • You'll probably want to .gitignore your cache's log files but keep the folder to avoid any warnings/errors (ie. npm_cache_mirror/_logs/*.log & npm_cache_mirror/anonymous-cli-metrics.json)

Demo

You can test out this method of caching/mirroring deps by:

  • Cloning this repo git clone git@github.com:darcyclarke/npm-offline-cache.git
  • Turn off your network connection
  • Install deps npm install
  • All deps required to support rawkit & sleepover should be installed into node_modules

About

πŸ“¦ An example of how to set up npm to point to a local project's cached/mirrored deps

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published