2

I am doing a npm install and getting the following error :

npm ERR! git rev-list -n1 8d27c06c2903538cd740a80edeae548922d057a5: fatal: bad object 8d27c06c2903538cd740a80edeae548922d057a5
npm ERR! git rev-list -n1 8d27c06c2903538cd740a80edeae548922d057a5:
npm ERR! git rev-list -n1 e92ca1c26c338ab641e70089cf8f57c140f39207: fatal: bad object e92ca1c26c338ab641e70089cf8f57c140f39207
npm ERR! git rev-list -n1 e92ca1c26c338ab641e70089cf8f57c140f39207:
npm ERR! git rev-list -n1 d90b1e34c799bf61cd1aafdc33db0a554fa9e617: fatal: bad object d90b1e34c799bf61cd1aafdc33db0a554fa9e617
npm ERR! git rev-list -n1 d90b1e34c799bf61cd1aafdc33db0a554fa9e617:
npm ERR! git rev-list -n1 f7f5bd678b80ec90c8d5c38c106f27466701fb2b: fatal: bad object f7f5bd678b80ec90c8d5c38c106f27466701fb2b
npm ERR! git rev-list -n1 f7f5bd678b80ec90c8d5c38c106f27466701fb2b:
npm ERR! git rev-list -n1 b7125954deccc8d802444effc02253b8729964a1: fatal: bad object b7125954deccc8d802444effc02253b8729964a1
npm ERR! git rev-list -n1 b7125954deccc8d802444effc02253b8729964a1:
npm ERR! git rev-list -n1 db701e170ba4cb11af3bac09411296cdb0e8215a: fatal: bad object db701e170ba4cb11af3bac09411296cdb0e8215a
npm ERR! git rev-list -n1 db701e170ba4cb11af3bac09411296cdb0e8215a:
npm ERR! git rev-list -n1 997ea0caad31d523b95cf64d03e28608561a36a6: fatal: bad object 997ea0caad31d523b95cf64d03e28608561a36a6
npm ERR! git rev-list -n1 997ea0caad31d523b95cf64d03e28608561a36a6:
npm ERR! git rev-list -n1 ea5466317ab75de6f46b0b39bae7a29c2aa18d68: fatal: bad object ea5466317ab75de6f46b0b39bae7a29c2aa18d68
npm ERR! git rev-list -n1 ea5466317ab75de6f46b0b39bae7a29c2aa18d68:
npm ERR! git rev-list -n1 2bebf3223b7b9ab00a18e294a52bcfffbbe066b7: fatal: bad object 2bebf3223b7b9ab00a18e294a52bcfffbbe066b7
npm ERR! git rev-list -n1 2bebf3223b7b9ab00a18e294a52bcfffbbe066b7:
npm ERR! git rev-list -n1 2dac046de6abc4c4f16ac25133c38cfe49a7368d: fatal: bad object 2dac046de6abc4c4f16ac25133c38cfe49a7368d
npm ERR! git rev-list -n1 2dac046de6abc4c4f16ac25133c38cfe49a7368d:
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v5.6.0
npm ERR! npm  v3.6.0
npm ERR! code 128

npm ERR! Command failed: git -c core.longpaths=true rev-list -n1 8d27c06c2903538cd740a80edeae548922d057a5
npm ERR! fatal: bad object 8d27c06c2903538cd740a80edeae548922d057a5
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

I googled the issue added the longPath true to the git config file and it looks like this

[credential]
    helper = manager

[remote "origin"]
    url = git@github.com:xxxx/xxxx-xx

[core]
    longpaths = true

My Package.json is

{
  "name": "xxxx-xx",
  "version": "0.0.1",
  "main": "app.js",
  "browserify": {
    "transform": [
      "html2js-browserify"
    ]
  },
  "scripts": {
    "postinstall": "gulp hook"
  },
  "dependencies": {
    "angular": "1.3.15",
    "angular-animate": "1.3.15",
    "angular-aria": "1.3.15",
    "angular-cookies": "1.3.15",
    "angular-dynamic-locale": "git+ssh://github.com/xxxx/angular-dynamic-locale",
    "angular-file-upload": "git+ssh://git@github.com/xxxx/angular-file-upload.git#v1.1.5",
    "angular-growl-v2": "git+ssh://git@github.com/xxxxx/angular-growl-2.git#0.7.4",
    "angular-i18n": "1.3.15",
    "angular-messages": "1.3.15",
    "angular-sanitize": "1.3.15",
    "angular-touch": "1.3.15",
    "angular-translate": "2.7.0",
    "angular-ui-bootstrap": "0.14.3",
    "angular-ui-router": "0.2.15",
    "backstopjs": "^1.2.1",
    "d3": "3.5.6",
    "d3.chart": "git+ssh://git@github.com/xxx/xxx-d3.chart.git",
    "gulp": "^3.9.0",
    "html-minifier": "^3.0.2",
    "html2js-browserify": "0.0.2",
    "intro.js": "git+ssh://git@github.com/xxxx/intro.js.git#v1.0.0",
    "lodash": "3.10.1",
    "moment": "^2.11.1",
    "moment-timezone": "^0.5.0",
    "ng-storage": "0.3.1",
    "ng-file-upload": "12.2.12",
    "omniture": "git+ssh://git@github.com/xxxx/xxxx-omniture.git",
    "ui-select": "git+ssh://git@github.com/xxxx/xxxx-ui-select.git"
  },
  "optionalDependencies": [
    "utf-8-validate",
    "bufferutil",
    "fsevents"
  ]
}

What I found by my research is,

  • This errors can happen due to long path in the file since the windows does not support the file name with too long paths. So as I early mentioned I added the long path to true in git config File

  • This error can also happen if the commit is corrupted or the git does not point to proper commit. For this i added #master to the end of all repositories and rerun the npm install. But nothing of these worked for me.

Am I missing something here. Thanks in advance.

Deep Kakkar
  • 5,831
  • 4
  • 39
  • 75
Krishna
  • 1,332
  • 5
  • 20
  • 35

2 Answers2

2

I have run into this issue a couple of times and it seems to stem from a bad or corrupted npm-shrinkwrap.json file. Rename or remove that file and try running npm install again.

A.Clifford
  • 76
  • 1
  • 4
1

I was struggling with this as well. I tried everything I could think of including updating node and npm, try to set longpath = true (it was already set) in my gitconfig file.

I was finally able to fix this by updating git. I was on 2.8.2 and I updated it to 2.13.0 and everything started working again. My guess is there was a bug that was fixed in the later version.

testing123
  • 11,367
  • 10
  • 47
  • 61