Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

npm install fails with overloaded repositories #3106

Closed
jmonster opened this Issue · 12 comments

7 participants

@jmonster

We are overloading our git repos to have different modules on different branches. This wasn't an issure until recently when I upgraded npm to the latest. If you repeatedly run npm install it eventually runs correctly.

npm WARN package.json module-name@0.0.0 No README.md file found!
npm ERR! git fetch -a origin (https://OUTAUTHTOKENHERE:@github.com/USERNAME/repo) error: Ref refs/heads/error is at 83df736dcf06ea3099895f9cfc01a521ddcff580 but expected 754d8ade90831e6b737d1dedd706f91de31623d3
npm ERR! git fetch -a origin (https://OUTAUTHTOKENHERE:@github.com/USERNAME/repo) From https://github.com/USERNAME/repo
npm ERR! git fetch -a origin (https://OUTAUTHTOKENHERE:@github.com/USERNAME/repo)  ! 754d8ad..83df736  error      -> error  (unable to update local ref)
npm ERR! git fetch -a origin (https://OUTAUTHTOKENHERE:@github.com/USERNAME/repo) error: Ref refs/heads/fetch is at 592a436b06d4b9f592a095573e04429ddd55b6b0 but expected 003726ce720c9d0c91abc02e91420559e4961baa
npm ERR! git fetch -a origin (https://OUTAUTHTOKENHERE:@github.com/USERNAME/repo)  ! 003726c..592a436  fetch      -> fetch  (unable to update local ref)
@isaacs
Owner

It looks like git fetch -a origin is failing. Plesae cd into ~/.npm/_git-remotes. In there you'll find some folders. One of them will have a name that looks like the git remote you're pulling. It's a bare git clone. cd into there, and run git fetch -a origin. Does it work?

@jmonster

I believe it is working, there is no output and a new command prompt comes up.

note/observation:

  • the first time I run npm install the folder doesn't exist and npm install fails.
  • the second time I run it this folder already exists and npm install suceeds
  • if I delete the folder and run npm install again it fails but this folder exists.

it appears to be consistent/deterministic and not a race condition -- the issue boils down to needing that folder to exist. The same folder is reused for mutliple modules that are in the same repo but scoped into different branches.

@isaacs
Owner

Can you please make something public that I can reproduce this with?

@jmonster

sure thing!

  1. I'm using npm 1.2.2
  2. git clone https://github.com/jmonster/npm-issue-3106
  3. npm install
  4. see error
  5. npm install
  6. succeed
  7. rm -rf node_modules && npm install
  8. succeed
  9. rm -rf ~/.npm/_git-remotes && npm install
  10. see step 4
@LindseyB

Heroku has updated their npm for deploys to be 1.2 so I am having issues when I try to deploy to heroku now too.

@jmonster

you can mitigate the problem on heroku by setting npm to 1.1.x ... less than ideal though

@normanjoyner

I'm having the same issue :( Downgrading to 1.1.x works for me as well.

@luk-

Does Heroku support more up to date versions of node/npm?

@luk-

npm 1.2 has been out since January. Have they been able to upgrade yet?

@jmonster
  • yes, heroku supports npm 1.1 and 1.2 and probably all the minor bumps as well.
  • kind of, we ended up pushing all the branches we had on one repo into multiple repos to mitigate the problem. npm still fails when trying to require multiple branches (as separate modules) from one repo -- it didn't prior to v1.2
@iarna
Owner

Duplicate of #6469

@iarna iarna added the bug label
@othiym23
Owner

It's possible that this is a regression, but we'll track it on #6469.

@othiym23 othiym23 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.