Coder Social home page Coder Social logo

Comments (4)

lukekarrys avatar lukekarrys commented on September 26, 2024 3

npx is hitting the network to fetch the packument and ensure there is not a newer version to run. This is easiest to see with --loglevel=http:

❯ npx --loglevel=http [email protected]
npm http fetch GET 200 https://registry.npmjs.org/gen-typed-validators 146ms (cache revalidated)
gen-typed-validators <files>
...

This makes sense in the case of npx gen-typed-validators@latest but probably not for npx [email protected] where a specific version is requested. On my network this "only" took 146ms, but still a decent cost to pay for something we know didn't change.

I also thought that the network request would be skipped if the cache is new enough (10 minutes?), but I haven't dug into the specifics if that's a bug or not.

I think it's reasonable that npx does not hit the network at least in the case of a specific version being requested. For @latest and bare specs, this is a tradeoff as many users have requested that the cache version not be used.

from cli.

milaninfy avatar milaninfy commented on September 26, 2024

@jedwards1211 I tried multiple times, but not able to reproduce the issue.

from cli.

jedwards1211 avatar jedwards1211 commented on September 26, 2024

@milaninfy one thing you could try is throttling your internet connection

from cli.

ljharb avatar ljharb commented on September 26, 2024

Anything that could change based on the network - tags and ranges - seem totally reasonable to always make an http call, but fwiw I totally agree that for a specific already-cached version, there's no value in checking.

from cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.