npm WARN addRemoteGit Error: Command failed

本文解决npm安装过程中出现的错误,主要是因为缓存目录中的_git-remotes导致的问题。提供了删除缓存目录的方法,并介绍了如何设置代理来避免安装过程中的中断。

npm install error

npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:211: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:885:16)
npm WARN addRemoteGit     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm WARN addRemoteGit  amcharts/ammap3 resetting remote C:\Users\holdlg\AppData\Roaming\npm-cache\_git-remotes\git-github-com-amcharts-ammap3-git-5b4c9c11 because of error: { Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:211: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:885:16)
npm WARN addRemoteGit     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:211: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:885:16)
npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:334:11)
npm WARN addRemoteGit     at emitOne (events.js:96:13)
npm WARN addRemoteGit     at Socket.emit (events.js:188:7)
npm WARN addRemoteGit     at Pipe._handle.close [as _onclose] (net.js:501:12)
npm WARN addRemoteGit  amcharts/amcharts3 resetting remote C:\Users\holdlg\AppData\Roaming\npm-cache\_git-remotes\git-github-com-amcharts-amcharts3-git-867ad69c because of error: { Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:211: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:885:16)
npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:334:11)
npm WARN addRemoteGit     at emitOne (events.js:96:13)
npm WARN addRemoteGit     at Socket.emit (events.js:188:7)
npm WARN addRemoteGit     at Pipe._handle.close [as _onclose] (net.js:501:12)
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }

解决方法

是因为npm缓存目录去缓存了个 _git-remotes 目录
windows路径:C:\Users\youname\AppData\Roaming\npm-cache
删除_git-remotes 再继续npm install。

如果总是中断,可以尝试设置代理试试。
(自备的Shadownsock代理地址http://127.0.0.1:1080)
git config –global http.proxy http://127.0.0.1:1080
git config –global https.proxy https://127.0.0.1:1080
git config –global http.proxy ‘socks5://127.0.0.1:1080’
git config –global https.proxy ‘socks5://127.0.0.1:1080’
取消代理
git config –global –unset http.proxy
git config –global –unset https.proxy

Microsoft Windows [版本 6.1.7601] 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。 D:\newjobfile\codefile\newfilecode1\vuetestfile>npm run dev > vuetestfile@0.0.0 dev > vite 'vite' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 D:\newjobfile\codefile\newfilecode1\vuetestfile>npm install npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'execa@9.5.2', npm WARN EBADENGINE required: { node: '^18.19.0 || >=20.5.0' }, npm WARN EBADENGINE current: { node: 'v19.9.0', npm: '9.6.3' } npm WARN EBADENGINE } npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'vite@6.2.2', npm WARN EBADENGINE required: { node: '^18.0.0 || ^20.0.0 || >=22.0.0' }, npm WARN EBADENGINE current: { node: 'v19.9.0', npm: '9.6.3' } npm WARN EBADENGINE } npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: '@vitejs/plugin-vue@5.2.3', npm WARN EBADENGINE required: { node: '^18.0.0 || >=20.0.0' }, npm WARN EBADENGINE current: { node: 'v19.9.0', npm: '9.6.3' } npm WARN EBADENGINE } npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'nanoid@5.1.5', npm WARN EBADENGINE required: { node: '^18 || >=20' }, npm WARN EBADENGINE current: { node: 'v19.9.0', npm: '9.6.3' } npm WARN EBADENGINE } npm ERR! code 1 npm ERR! path D:\newjobfile\codefile\newfilecode1\vuetestfile\node_modules\esbui ld npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node install.js npm ERR! node:internal/errors:867 npm ERR! const err = new Error(message); npm ERR! ^ npm ERR! npm ERR! Error: Command failed: D:\newjobfile\nodefile\node.exe D:\newjobfile\co defile\newfilecode1\vuetestfile\node_modules\esbuild\bin\esbuild --version npm ERR! Exception 0xc0000005 0x8 0x0 0x0 npm ERR! PC=0x0 npm ERR! npm ERR! runtime.asmstdcall(0x2a0700060009) npm ERR! runtime/sys_windows_amd64.s:76 +0x89 fp=0xdaf780 sp=0xdaf760 pc= 0xd8e69 npm ERR! rax 0x0 npm ERR! rbx 0xa3c780 npm ERR! rcx 0xa844a8 npm ERR! rdx 0x20 npm ERR! rdi 0x7fffffde000 npm ERR! rsi 0xdaf978 npm ERR! rbp 0xdaf8c0 npm ERR! rsp 0xdaf758 npm ERR! r8 0xa3c4a0 npm ERR! r9 0xa840ca npm ERR! r10 0xdba2e8 npm ERR! r11 0xc000004000 npm ERR! r12 0xdaf9c8 npm ERR! r13 0x0 npm ERR! r14 0xa3b660 npm ERR! r15 0x3 npm ERR! rip 0x0 npm ERR! rflags 0x10246 npm ERR! cs 0x33 npm ERR! fs 0x53 npm ERR! gs 0x2b npm ERR! node:child_process:924 npm ERR! throw err; npm ERR! ^ npm ERR! npm ERR! Error: Command failed: D:\newjobfile\codefile\newfilecode1\vuetestfile\ node_modules\@esbuild\win32-x64\esbuild.exe --version npm ERR! at checkExecSyncError (node:child_process:885:11) npm ERR! at Object.execFileSync (node:child_process:921:15) npm ERR! at Object.<anonymous> (D:\newjobfile\codefile\newfilecode1\vuetestf ile\node_modules\esbuild\bin\esbuild:221:28) npm ERR! at Module._compile (node:internal/modules/cjs/loader:1275:14) npm ERR! at Module._extensions..js (node:internal/modules/cjs/loader:1329:10 ) npm ERR! at Module.load (node:internal/modules/cjs/loader:1133:32) npm ERR! at Module._load (node:internal/modules/cjs/loader:972:12) npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modul es/run_main:83:12) npm ERR! at node:internal/main/run_main_module:23:47 { npm ERR! status: 2, npm ERR! signal: null, npm ERR! output: [ null, null, null ], npm ERR! pid: 7396, npm ERR! stdout: null, npm ERR! stderr: null npm ERR! } npm ERR! npm ERR! Node.js v19.9.0 npm ERR! npm ERR! at checkExecSyncError (node:child_process:885:11) npm ERR! at Object.execFileSync (node:child_process:921:15) npm ERR! at validateBinaryVersion (D:\newjobfile\codefile\newfilecode1\vuete stfile\node_modules\esbuild\install.js:101:28) npm ERR! A complete log of this run can be found in: D:\newjobfile\nodefile\node _cache\_logs\2025-03-20T00_55_22_540Z-debug-0.log D:\newjobfile\codefile\newfilecode1\vuetestfile>
03-21
E:\IDEA_files\test\testvue01>npm install npm WARN locking Error: EPERM: operation not permitted, open 'E:\node.js\node_cache\_locks\staging-e46407c84593f6b3.lock' npm WARN locking E:\node.js\node_cache\_locks\staging-e46407c84593f6b3.lock failed [Error: EPERM: operation not permitted, open 'E:\node.js\node_cache\_locks\staging-e46407c84593f6b3.lock'] { npm WARN locking errno: -4048, npm WARN locking code: 'EPERM', npm WARN locking syscall: 'open', npm WARN locking path: 'E:\\node.js\\node_cache\\_locks\\staging-e46407c84593f6b3.lock' npm WARN locking } npm ERR! code EPERM npm ERR! syscall open npm ERR! path E:\node.js\node_cache\_locks\staging-e46407c84593f6b3.lock npm ERR! errno -4048 npm ERR! Error: EPERM: operation not permitted, open 'E:\node.js\node_cache\_locks\staging-e46407c84593f6b3.lock' npm ERR! [Error: EPERM: operation not permitted, open 'E:\node.js\node_cache\_locks\staging-e46407c84593f6b3.lock'] { npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'open', npm ERR! path: 'E:\\node.js\\node_cache\\_locks\\staging-e46407c84593f6b3.lock' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It's possible that the file was already in use (by a text editor or antivirus), npm ERR! or that you lack permissions to access it. npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.
04-25
C:\xtreme1-main\frontend\main>npm install npm WARN cleanup Failed to remove some directories [ npm WARN cleanup [ npm WARN cleanup 'C:\\xtreme1-main\\frontend\\main\\node_modules\\cwebp-bin', npm WARN cleanup [Error: EBUSY: resource busy or locked, rmdir 'C:\xtreme1-main\frontend\main\node_modules\cwebp-bin'] { npm WARN cleanup errno: -4082, npm WARN cleanup code: 'EBUSY', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'C:\\xtreme1-main\\frontend\\main\\node_modules\\cwebp-bin' npm WARN cleanup } npm WARN cleanup ], npm WARN cleanup [ npm WARN cleanup 'C:\\xtreme1-main\\frontend\\main\\node_modules\\cwebp-bin', npm WARN cleanup [Error: EBUSY: resource busy or locked, rmdir 'C:\xtreme1-main\frontend\main\node_modules\cwebp-bin'] { npm WARN cleanup errno: -4082, npm WARN cleanup code: 'EBUSY', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'C:\\xtreme1-main\\frontend\\main\\node_modules\\cwebp-bin' npm WARN cleanup } npm WARN cleanup ] npm WARN cleanup ] npm ERR! code 1 npm ERR! path C:\xtreme1-main\frontend\main\node_modules\gifsicle npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node lib/install.js npm ERR! compiling from source npm ERR! unable to verify the first certificate npm ERR! gifsicle pre-build test failed npm ERR! Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "autoreconf -ivf" npm ERR! 'autoreconf' �����ڲ����ⲿ���Ҳ���ǿ����еij��� npm ERR! ���������ļ��� npm ERR! npm ERR! npm ERR! at C:\xtreme1-main\frontend\main\node_modules\bin-build\node_modules\execa\index.js:231:11 npm ERR! at processTicksAndRejections (node:internal/process/task_queues:96:5) npm ERR! at async Promise.all (index 0)
03-27
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值