Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

install from cache if the requested version is available #12061

Closed
deepu105 opened this issue Mar 25, 2016 · 1 comment
Closed

install from cache if the requested version is available #12061

deepu105 opened this issue Mar 25, 2016 · 1 comment

Comments

@deepu105
Copy link

Im opening a new issue here as the others similar to this quite doesnt explain all the problems and hence I would like to summarize my thoughts.

Sorry if I sound silly anywhere. Im not familiar with internal NPM architecture.

  1. When I run npm install NPM seems to check the online registry first and not the cache (I might be wrong but it sure goes to online registry). I dont really understand the need for this, if the requested version is available in the npm global cache why not use it and save the round trip? this would have avoided the whole azer npm left-pad fiasco to an extend in the first place as left-pad would have been loaded from the cache. This is how maven, gradle, bower etc does if im not wrong
  2. If all my node_modules are upto date and if I run npm install it still goes and checks the online registry and if I'm offline NPM just hangs there (Im on windows btw)
  3. there needs to be atleast an --offline flag that would purely install from cache and go to registry only for un available versions of a repo

If NPM could just use the cache effectively it would save a lot of install time and network cost.
Sorry if its a duplicate somehow

EDIT: I know that there is a cache-min xxxxxx stuff but its not very intuitive
Also I know if I have a semver range defined you would have to hit the registry to check but atleast for package json dependency where all the modules are declared using a full semever exact version instead of a range the registry hitting should be avoided

so for a package.json dependencies like below why should you go to registry when i run npm i ?

  "dependencies": {
    "bower": "1.6.3",
    "gulp": "3.9.1",
    "del": "2.2.0"
  }
@othiym23
Copy link
Contributor

Closing as duplicate of #2568. This will be added at some point!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants