MCPcopy Create free account
hub / github.com/npm/cli / npxRm

Method npxRm

lib/commands/cache.js:289–308  ·  view source on GitHub ↗
(keys)

Source from the content-addressed store, hash-verified

287 }
288
289 async npxRm (keys) {
290 if (!keys.length) {
291 if (!this.npm.config.get('force')) {
292 throw this.usageError('Please use --force to remove entire npx cache')
293 }
294 const { npxCache } = this.npm.flatOptions
295 if (!this.npm.config.get('dry-run')) {
296 return fs.rm(npxCache, { recursive: true, force: true })
297 }
298 }
299
300 const cache = await this.#npxCache(keys)
301 for (const key in cache) {
302 const { path: cachePath } = cache[key]
303 output.standard(`Removing npx key at ${cachePath}`)
304 if (!this.npm.config.get('dry-run')) {
305 await fs.rm(cachePath, { recursive: true })
306 }
307 }
308 }
309
310 async npxInfo (keys) {
311 const chalk = this.npm.chalk

Callers 1

npxMethod · 0.95

Calls 4

#npxCacheMethod · 0.95
usageErrorMethod · 0.80
getMethod · 0.45
rmMethod · 0.45

Tested by

no test coverage detected