问题描述
我正在使用scp2将文件复制到targetPath。 config包含主机,用户名,privateKey,路径和端口。
const client = require('scp2');
export function scpAsync(config,targetPath) {
return new Promise((resolve,reject) => {
client.scp(config,targetPath,err => {
if (!err){
resolve();
} else {
const errorMessage = err;
reject(errorMessage);
}
});
});
}
这样做时出现错误:
Error: Timed out while waiting for handshake
我也试图通过
promptForPass: false
但是它没有改变任何东西。除此之外,我还使用了调试模式,该模式告诉我我已连接到服务器,并设置了更高的setTimeout,但是错误稍后才会出现。我正在查看scp2及其GitHub的文档。我使用那里介绍的功能(Pull Request),关于错误,他们可以使用更高的setTimeout(https://www.npmjs.com/package/scp2)来解决。我尝试在ec2实例上使用本地ftp服务器,ngrok和ftp。都有相同的问题。
我很高兴获得帮助。我也对超级用户问了这个问题,但没有得到答案: https://github.com/spmjs/node-scp2/issues/107
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)