npm / npx

npm package executor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] npx installs the lib upon each execution from scratch, instead of using cache

LiranBri opened this issue · comments

What / Why

npx installs the lib for every executions every time, instead of using cache.
I get the following output:
npx: installed 92 in 40.544s

I would expect it to happen only upon the first time, and on following executions to be served from cache very fast.

When

Every time I execute the command via npx

Where

Private NPM repository

Current Behavior

Every time I execute a command it re-installs from scratch

Expected Behavior

To load the lib from cache, similar to what would have happened if it was installed globally

I believe it does use the cache for the downloaded tarball, it just unpacks the tarball every time to ensure a fresh copy.

@ljharb if its just CPU thing, it makes sense to take 40 seconds?

that is a good point :-)