pacote icon indicating copy to clipboard operation
pacote copied to clipboard

Crashes if run without cache option

Open Lambdac0re opened this issue 6 years ago • 4 comments

I'm running the following code and it crashes at lib\fetchers\git.js:59 because cacheStream is undefined

require('pacote').manifest('git+http://local-git:7990/server.git#semver:^2.0.0').then(wow => {
  log(wow)
})

Lambdac0re avatar Feb 26 '18 09:02 Lambdac0re

Unhandled rejection TypeError: Cannot read property 'pipe' of undefined
    at Object.fromManifest (C:\js\generator\node_modules\pacote\lib\fetchers\git.js:59:17)
    at Object.Fetcher#fromManifest [as fromManifest] (C:\js\generator\node_modules\genfun\lib\genfun.js:15:38)
    at fromManifest (C:\js\generator\node_modules\pacote\lib\fetch.js:26:32)
    at tarballedProps (C:\js\generator\node_modules\pacote\lib\finalize-manifest.js:150:23)
    at cachedManifest.then.cached (C:\js\generator\node_modules\pacote\lib\finalize-manifest.js:48:14)
    at tryCatcher (C:\js\generator\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\js\generator\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (C:\js\generator\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromiseCtx (C:\js\generator\node_modules\bluebird\js\release\promise.js:606:10)
    at Async._drainQueue (C:\js\generator\node_modules\bluebird\js\release\async.js:138:12)
    at Async._drainQueues (C:\js\generator\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (C:\js\generator\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)

Lambdac0re avatar Feb 26 '18 09:02 Lambdac0re

Yeah. I've known about this for a while -- it only affects git deps and pacote doesn't run without a cache in the real-world application uses I tend to use it for, so it was kinda low priority. I also wanted to make some architectural changes to how git deps were handled before fixing this bit.

If anyone's interested in picking this fix up, it's fairly well isolated and largely just needs some work done in the git fetcher.

zkat avatar Mar 15 '18 07:03 zkat

~Could you give some indications as to what you would like to happen? Beyond just fixing it? If you have a background of why this is happening that's an added bonus. Like i said i don't even know why you need to use end-of-stream for this specific situation (afaics it doesn't need the extra handling beyond the naïve onclose handler to promise)~

EDIT: My apologies. Please ignore, I have mistakenly thought that this is a comment for the newly opened issue 143 (by me)

andreineculau avatar Mar 15 '18 08:03 andreineculau

I'm trying to check for newer versions from git so i do not need pacote to checkout the repo anyway

Lambdac0re avatar Mar 15 '18 08:03 Lambdac0re