npm install fails with overloaded repositories #3106

jmonster opened this Issue Jan 28, 2013 · 12 comments


None yet

7 participants


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 file found!
npm ERR! git fetch -a origin ( error: Ref refs/heads/error is at 83df736dcf06ea3099895f9cfc01a521ddcff580 but expected 754d8ade90831e6b737d1dedd706f91de31623d3
npm ERR! git fetch -a origin ( From
npm ERR! git fetch -a origin (  ! 754d8ad..83df736  error      -> error  (unable to update local ref)
npm ERR! git fetch -a origin ( error: Ref refs/heads/fetch is at 592a436b06d4b9f592a095573e04429ddd55b6b0 but expected 003726ce720c9d0c91abc02e91420559e4961baa
npm ERR! git fetch -a origin (  ! 003726c..592a436  fetch      -> fetch  (unable to update local ref)
isaacs commented Jan 30, 2013

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?


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


  • 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 commented Jan 30, 2013

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


sure thing!

  1. I'm using npm 1.2.2
  2. git clone
  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

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.


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


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

luk- commented Apr 23, 2013

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

luk- commented May 20, 2013

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

  • 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 commented Oct 17, 2014

Duplicate of #6469

@iarna iarna added the bug label Oct 17, 2014

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

@othiym23 othiym23 closed this Oct 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment