MS Windows 10:错误:命令失败:git -c core.longpaths = true config --get remote.origin.url

Abh*_*kur 5 windows git node.js

我正在尝试在Windows机器上使用npm i安装我的项目依赖项.但是我登陆了这个错误:

npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:202:12)
npm WARN addRemoteGit     at emitTwo (events.js:106:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:850:16)
npm WARN addRemoteGit     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
npm WARN addRemoteGit  git+https://5345345erg345eg34eg:x-oauth-basic@github.com/test/test.git resetting remote C:\Users\Administrator\AppData\Roaming\npm-cache\_git-remotes\git-https-test-89f19adf because of error: { Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i"
npm ERR! node v6.2.0
npm ERR! npm  v3.8.9
npm ERR! code 128
npm ERR! fatal: bad object 1cf23bc52c0a3b1b5dde89949ff9f820522e0367
npm ERR! fatal: remote did not send all necessary objects
Run Code Online (Sandbox Code Playgroud)

我做了一些研究,发现这个问题与不支持长度超过260个字符的文件和目录的窗口有关.我得到的解决方法是使用此命令来允许长路径文件名:

git config core.longpaths true
Run Code Online (Sandbox Code Playgroud)

但这似乎并没有起作用.任何人都可以建议一个解决方法,为什么会发生这种情况?

节点和NPM版本: 节点: v6.2.0 NPM: 3.8.9

如果我需要提供更多详细信息,请告诉我们?

Mey*_*ehr 1

你必须更新你的 npm。我在更新到 npm 5 之前遇到了这个问题。