npm安装上的致命错误对象错误

时间:2017-01-30 12:19:00

标签: node.js git github npm npm-install

我正在进行npm安装并收到以下错误:

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>

我用Google搜索了问题,将longPath true添加到git配置文件中,它看起来像这样

[credential]
    helper = manager

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

[core]
    longpaths = true

我的Package.json是

{
  "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"
  ]
}

我的研究结果是,

  • 由于Windows中不支持路径太长的文件名,因此文件中的路径较长,可能会发生此错误。因此,正如我之前提到的,我在git config File

  • 中添加了长路径为true
  • 如果提交已损坏或git未指向正确提交,也会发生此错误。为此,我将#master添加到所有存储库的末尾,然后重新运行npm install。但这些都不适合我。

我在这里遗漏了什么。提前谢谢。

2 个答案:

答案 0 :(得分:2)

我已经遇到过几次这个问题,它似乎是由npm-shrinkwrap.json文件损坏或损坏引起的。重命名或删除该文件,然后尝试再次运行npm install。

答案 1 :(得分:1)

我也在努力解决这个问题。我尝试了所有我能想到的,包括更新节点和npm,尝试在我的gitconfig文件中设置longpath = true(它已经设置好了)。

我终于能够通过更新git来解决这个问题了。我在2.8.2,我将其更新到2.13.0,一切都开始工作了。我的猜测是在后来的版本中修复了一个错误。