INFO Start processing INFO Files loaded in 2.58 s INFO 0 files generated in 3.25 s INFO Deploying: rsync 'rsync' is not recognized as an internal or external command, operable program or batch file. FATAL { err: Error: spawn rsync ENOENT at notFoundError (D:\git\personal\test_blog\node_modules\cross-spawn\lib\enoent.js:6:26) at verifyENOENT (D:\git\personal\test_blog\node_modules\cross-spawn\lib\enoent.js:40:16) at cp.emit (D:\git\personal\test_blog\node_modules\cross-spawn\lib\enoent.js:27:25) at ChildProcess._handle.onexit (node:internal/child_process:291:12) { code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn rsync', path: 'rsync', spawnargs: [ '--delete', '--ignore-errors', '-v', '-az', '-e', 'D:\\soft\\install\\cwrsync_6.2.8_x64_free\\bin\\ssh -p 22', 'public/', 'root@www.test.com:/www/test_blog' ] } } Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
‘rsync’ is not recognized as an internal or external command
其实这个错误说的挺明显的了,rsync无法识别,于是搜索windows hexo 'rsync' is not recognized as an internal or external command,得到了使用Hexo发布博客(Windows环境),了解到windows系统默认没有rsync,因此需要下载安装。
INFO Start processing INFO Files loaded in 2.19 s INFO 0 files generated in 3.11 s INFO Deploying: rsync root@www.test.com's password: rsync: connection unexpectedly closed (0 bytes received so far) [Receiver] rsync error: error in rsync protocol data stream (code 12) at io.c(226) [Receiver=3.1.2] rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(231) [sender=3.2.7] FATAL { err: Error: rsync: connection unexpectedly closed (0 bytes received so far) [Receiver] rsync error: error in rsync protocol data stream (code 12) at io.c(226) [Receiver=3.1.2] rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(231) [sender=3.2.7] at ChildProcess.<anonymous> (D:\git\personal\test_blog\node_modules\hexo-deployer-rsync\node_modules\hexo-util\lib\spawn.js:36:19) at ChildProcess.emit (node:events:513:28) at cp.emit (D:\git\personal\test_blog\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1091:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5) { code: 12 } } Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
err: Error: rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
于是网上搜索 hexo windows err: Error: rsync: connection unexpectedly closed (0 bytes received so far) [Receiver] 搜到了Cygwin 使用rsync 报错解决这篇文章,经过验证后,确认是因为rsync 的ssh和系统默认的ssh冲突导致的,具体原因这里就不深入了。
由于rsync实际要调用ssh,而在调用ssh时,系统的open ssh优先,实际调用了open ssh,没有调用到rsync自带的ssh,导致版本错配,进而发生了rsync error: error in rsync protocol data stream (code 12) at io.c(231)这个异常。
INFO Start processing INFO Files loaded in 2.58 s INFO 0 files generated in 3.9 s INFO Deploying: rsync Host key verification failed. rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(231) [sender=3.2.7] FATAL { err: Error: Host key verification failed. rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(231) [sender=3.2.7]
at ChildProcess.<anonymous> (D:\git\personal\test_blog\node_modules\hexo-deployer-rsync\node_modules\hexo-util\lib\spawn.js:36:19) at ChildProcess.emit (node:events:513:28) at cp.emit (D:\git\personal\test_blog\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1091:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5) { code: 12 } } Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
INFO Start processing INFO Files loaded in 2.1 s INFO 0 files generated in 3.04 s INFO Deploying: rsync Permission denied, please try again. Permission denied, please try again. root@www.test.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(231) [sender=3.2.7] FATAL { err: Error: Permission denied, please try again. Permission denied, please try again. root@www.test.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(231) [sender=3.2.7]
at ChildProcess.<anonymous> (D:\git\personal\test_blog\node_modules\hexo-deployer-rsync\node_modules\hexo-util\lib\spawn.js:36:19) at ChildProcess.emit (node:events:513:28) at cp.emit (D:\git\personal\test_blog\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1091:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5) { code: 12 } } Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
修改前 if (args.verbose) params.unshift('-v'); if (args.ignore_errors) params.unshift('--ignore-errors'); if (args.delete) params.unshift('--delete'); if (args.args) params.unshift(args.args); 修改后 params.unshift('--chmod=ugo=rx'); if (args.verbose) params.unshift('-v'); if (args.ignore_errors) params.unshift('--ignore-errors'); if (args.delete) params.unshift('--delete'); if (args.args) params.unshift(args.args);