【发布时间】:2019-01-16 07:56:07
【问题描述】:
我正在执行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>
我用谷歌搜索了这个问题,在 git 配置文件中添加了 longPath true,它看起来像这样
[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 文件中添加了通往 true 的长路径
如果提交已损坏或 git 未指向正确提交,也会发生此错误。为此,我将#master 添加到所有存储库的末尾并重新运行
npm install。但这些都不适合我。
我在这里错过了什么吗?提前致谢。
【问题讨论】:
-
在再次尝试
npm install之前,您是否删除了node_modules文件夹? -
@J.Titus:节点模块内什么都没有。但是我删了再试一次还是有问题
标签: node.js git github npm npm-install