10 examples of 'clear npm cache' in JavaScript

Every line of 'clear npm cache' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
42_clear() {
43 this.entries = Object.create(null);
44 this.projects = [];
45 _resetCache();
46}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

82public nukePackageCache() {
83 this.clearMemory();
84 this.clearTree();
85 removeFolder(this.packageCacheFolder);
86}
8clear() {
9 this.cache.clear();
10
11 return this;
12}
39clear() {
40 this._storage = {};
41 return this;
42}
8export async function clearCaches(caches) {
9 const cacheNames = await caches.keys();
10 await Promise.all(cacheNames.map(cacheName => clearCache(caches, cacheName)));
11}
186clearCache() {
187 this.set(CACHE_BBOX, null); // 清理缓存的 bbox
188 this.set(CACHE_ANCHOR_POINTS, null);
189}
18export function clearCache() {
19 const cachePath = getCachePath();
20 const cacheFile = path.join(cachePath, CacheFileName);
21
22 if (fs.existsSync(cacheFile)) {
23 fs.removeSync(cacheFile);
24 }
25}
12clear() {
13 this._deps = Object.create(null);
14}
65clearCache () {
66 return NewAPIService.get(`projects/${this.project.id}/builds/${this.id}/cache/clear`)
67 .then((message) => {
68 NotificationService.$emit('NOTIFICATION', new Notification(message, 'done'))
69 })
70 .catch((err) => {
71 NotificationService.$emit('NOTIFICATION', new Notification(err))
72 })
73}
111function cleanNodeModulePackages() {
112 return del(cleanGlobs);
113}

Related snippets