Giter Club home page Giter Club logo

Comments (6)

GongT avatar GongT commented on July 29, 2024 1

Sorry for my English first.

npm -A-> npm-register -B-> upstream(npm.org)

The issue happen at A.

you can compare same debug package on two different registry:
china mirror: https://registry.npm.taobao.org/debug
original npm: https://registry.npmjs.org/debug

look at tarball:
china mirror: "http://registry.npm.taobao.org/debug/download/debug-3.1.0.tgz"
original npm: "https://registry.npmjs.org/debug/-/debug-0.1.0.tgz"

npm-register's router is waiting for npm to request /debug/-/debug-0.1.0.tgz.
But if the upstream is set to https://registry.npm.taobao.org/ , npm client will make request to "http://npm-register/debug/download/debug-3.1.0.tgz", then npm client got 404 error.

from npm-register.

jdx avatar jdx commented on July 29, 2024

I'm not following. What's the problem?

from npm-register.

GongT avatar GongT commented on July 29, 2024

tarballs router
r.get('/:scope?/:name/-/:scope2?/:filename/:sha', function * () {
This consider npm(cli) will try to download tarball from url looks like: /@types/node/-/@types/node-x.y.z/xxxxxxxxxx.tgz

But in fact, npm will download tarball from anywhere defined by package.versions['x.y.z'].dist.tarball

No documented rule about package.versions['x.y.z'].dist.tarball, and some unofficial npm cdn will modify package json.

eg: http://registry.npm.taobao.org/@types%2Fnode

{
  "versions": {
    "0.0.1": {
      "dist": {
        "shasum": "d90a4d3bf1fe8f961edf0f76f34a7a6df79580be",
        "size": 28040,
        "noattachment": false,
        tarball: "http://registry.npm.taobao.org/@types/node/download/@types/node-0.0.1.tgz"
      },
    }
  }
}

the packages router will rewriteTarballURLs this url to http://127.0.0.1:45678/@types/node/download/@types/node-0.0.1.tgz

Then npm will fail to download http://127.0.0.1:45678/@types/node/download/@types/node-0.0.1.tgz with a 404.

from npm-register.

dgautsch avatar dgautsch commented on July 29, 2024

@GongT is this still an issue for you?

from npm-register.

GongT avatar GongT commented on July 29, 2024

I'm using sinopia now...
But looks like lib/routes/tarballs.js is still using wrong path.

from npm-register.

dgautsch avatar dgautsch commented on July 29, 2024

Ok thanks. I think I understand this now, but could you clarify a little more? I believe this is only an issue if the package doesn't exist in npm-register and it gets passed through to npm with the wrong URL. What are the other use cases? Thanks!

from npm-register.

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.