Powershell grunt sftp部署无法连接到服务器

Powershell grunt sftp部署无法连接到服务器,powershell,gruntjs,sftp,Powershell,Gruntjs,Sftp,我是咕哝的能手,我想开始使用它。 这是我的Grunfile文件: module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), devDir: 'dev/dir', prodDir: 'prod/dir', 'sftp-deploy': { prod: { auth: { host: 's

我是咕哝的能手,我想开始使用它。 这是我的Grunfile文件:

module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
devDir: 'dev/dir',
prodDir: 'prod/dir',

'sftp-deploy': {
  prod: {
    auth: {
      host: 'server.com',
      port: 22,
      authKey: {
        "username": "username1",
        "password": "password2"
      }
    },
    src: '<%=devDir%>',
    dest: '/test/env/',
    concurrency: 4,
    progress: true
  }
}
});

// load modules
grunt.loadNpmTasks('grunt-sftp-deploy');
// Default task(s).
grunt.registerTask('default', ['sftp-deploy']);

};
在powershell中运行“grunt”时出现此错误:

正在运行sftp部署:prod sftp部署任务

使用用户名username1登录

并发:4

致命错误:连接::错误

我做错了什么?
谢谢

好的,有几件事要尝试一下。。。对不起,晚了一个月

运行:

 grunt sftp-deploy --verbose
这将为您提供有关错误的更多信息

在意识到无法在服务器上创建文件夹,只能上载文件后,我解决了错误。因此,您可以手动完成请求grunt执行的操作,这可能值得测试

最后,尝试将用户名/密码移动到.ftppass文件中

链接[此处]