{"id":45613,"library":"npm-cache","title":"npm-cache","description":"A command-line utility that caches dependencies installed via npm, bower, jspm, and composer to reduce build times. It works by hashing the configuration file (package.json, bower.json, etc.) and storing the resulting tarball in a local cache directory (~/.package_cache by default). On subsequent runs, it extracts the cached tarball instead of re-installing. The latest version is 0.8.0 (last updated in 2017), with no active development. It is a simple, pragmatic solution for CI environments that run installs repeatedly, but lacks tests and modern best practices.","status":"maintenance","version":"0.8.0","language":"javascript","source_language":"en","source_url":"git://github.com/swarajban/npm-cache","tags":["javascript","npm","cache","install","bower","jspm","composer","local"],"install":[{"cmd":"npm install npm-cache","lang":"bash","label":"npm"},{"cmd":"yarn add npm-cache","lang":"bash","label":"yarn"},{"cmd":"pnpm add npm-cache","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This is a CLI tool, not a library. Do not attempt to import it programmatically.","wrong":"require('npm-cache')","symbol":"npm-cache (CLI)","correct":"npm install -g npm-cache && npm-cache install"}],"quickstart":{"code":"npm install -g npm-cache\ncd /path/to/project\nnpm-cache install\n# On first run, installs dependencies and caches them.\n# On subsequent runs, restores from cache if configuration unchanged.\nnpm-cache install --cacheDirectory /tmp/cache bower --allow-root\nnpm-cache clean","lang":"javascript","description":"Shows global installation and basic usage of npm-cache CLI to install and cache dependencies."},"warnings":[{"fix":"Use --cacheDirectory /path/to/cache to specify a custom location.","message":"Cache directory defaults to ~/.package_cache. Ensure it exists and is writable or use --cacheDirectory.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Check that network and permissions are available on first run.","message":"Only caches dependencies after a successful install. If install fails, cache is not updated.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use a more modern tool like npm ci with caching or a dedicated CI cache step.","message":"No support for lockfiles (package-lock.json, yarn.lock). Caching based solely on package.json may lead to inconsistencies.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Consider alternatives like npm ci with --prefer-offline or CI-native caching.","message":"The package is not actively maintained. Last release in 2017. No updates for breaking changes in npm or other package managers.","severity":"deprecated","affected_versions":">=0.8.0"}],"env_vars":null,"search_vec":"'/.package_cache':43 '0.8.0':63 '2017':67 'activ':70 'best':90 'bower':15,96 'bower.json':31 'build':21 'cach':3,10,41,52,94 'ci':79 'command':6 'command-lin':5 'compos':18,98 'configur':28 'default':45 'depend':11 'develop':71 'directori':42 'environ':80 'etc':32 'extract':50 'file':29 'hash':26 'instal':12,58,83,95 'instead':54 'javascript':92 'jspm':16,97 'lack':86 'last':64 'latest':60 'line':7 'local':40,99 'modern':89 'npm':2,14,93 'npm-cach':1 'package.json':30 'practic':91 'pragmat':76 're':57 're-instal':56 'reduc':20 'repeat':84 'result':36 'run':48,82 'simpl':75 'solut':77 'store':34 'subsequ':47 'tarbal':37,53 'test':87 'time':22 'updat':65 'util':8 'version':61 'via':13 'work':24","created_at":"2026-06-07T12:55:51.981194+00:00","updated_at":"2026-06-07T12:55:51.981194+00:00","problems":[{"fix":"Run with sudo or set --cacheDirectory to a user-writable location.","cause":"npm-cache cannot write to default cache directory due to permissions.","error":"Error: EACCES: permission denied, open '/home/user/.package_cache/...'"},{"fix":"Use --forceRefresh to force a fresh install without cache, or ensure package.json is stable.","cause":"Cache restored but lockfile or exact versions mismatch.","error":"Cannot find module '...' after npm-cache install"},{"fix":"Check network connectivity and npm configuration, then retry.","cause":"npm-cache does not handle npm errors gracefully; if npm install fails, cache is not populated.","error":"Command failed: npm install"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/swarajban/npm-cache","github":"git://github.com/swarajban/npm-cache","docs":null,"changelog":null,"pypi":null,"npm":"npm-cache","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}