Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
gulp sftp上的gulp sftp错误_Ftp_Gulp_Sftp - Fatal编程技术网

gulp sftp上的gulp sftp错误

gulp sftp上的gulp sftp错误,ftp,gulp,sftp,Ftp,Gulp,Sftp,我已经用gulp sftp设置了一个gulp任务,并尝试了两个站点连接到它,但没有成功。我已经用Filezilla尝试了这两种方法,并且都在连接 我的任务如下: var sftp = require('gulp-sftp'); gulp.task('sftp', function () {     return gulp.src('dist/**/*')         .pipe(sftp({             host: 'waws-prod-s

我已经用gulp sftp设置了一个gulp任务,并尝试了两个站点连接到它,但没有成功。我已经用Filezilla尝试了这两种方法,并且都在连接

我的任务如下:

var sftp = require('gulp-sftp');        
gulp.task('sftp', function () {
        return gulp.src('dist/**/*')
            .pipe(sftp({
                host: 'waws-prod-sn1-015.ftp.azurewebsites.windows.net',
                user: 'fwd16\$fwd16',
                pass: 'xxxxxx',
                remotePath: '/site/wwwroot'
            }));
    });
bash-3.2$ gulp sftp                                                                                                                            
[22:29:18] Using gulpfile ~/Desktop/gulp-starter-csstricks/gulpfile.js                                                                         
[22:29:18] Starting 'sftp'...                                                                                                                  
[22:29:18] Authenticating with password.                                                                                                       
[22:29:28] 'sftp' errored after 10 s                                                                                                           
[22:29:28] Error in plugin 'gulp-sftp'                                                                                                         
Message:                                                                                                                                       
    Timed out while waiting for handshake                                                                                                      
Details:                                                                                                                                       
    level: connection-timeout                                                                                                                  
[22:29:28] gulp-sftp SFTP abrupt closure                                                                                                       
[22:29:28] Connection :: close
gulp.task('sftp', function () {
    return gulp.src('dist/**/*')
        .pipe(sftp({
            host: 'waws-prod-sn1-015.ftp.azurewebsites.windows.net',
            authFile:'.ftppass',
            auth: 'keyMain',
            remotePath: '/site/wwwroot'
        }));
}); 
我得到的答复如下:

var sftp = require('gulp-sftp');        
gulp.task('sftp', function () {
        return gulp.src('dist/**/*')
            .pipe(sftp({
                host: 'waws-prod-sn1-015.ftp.azurewebsites.windows.net',
                user: 'fwd16\$fwd16',
                pass: 'xxxxxx',
                remotePath: '/site/wwwroot'
            }));
    });
bash-3.2$ gulp sftp                                                                                                                            
[22:29:18] Using gulpfile ~/Desktop/gulp-starter-csstricks/gulpfile.js                                                                         
[22:29:18] Starting 'sftp'...                                                                                                                  
[22:29:18] Authenticating with password.                                                                                                       
[22:29:28] 'sftp' errored after 10 s                                                                                                           
[22:29:28] Error in plugin 'gulp-sftp'                                                                                                         
Message:                                                                                                                                       
    Timed out while waiting for handshake                                                                                                      
Details:                                                                                                                                       
    level: connection-timeout                                                                                                                  
[22:29:28] gulp-sftp SFTP abrupt closure                                                                                                       
[22:29:28] Connection :: close
gulp.task('sftp', function () {
    return gulp.src('dist/**/*')
        .pipe(sftp({
            host: 'waws-prod-sn1-015.ftp.azurewebsites.windows.net',
            authFile:'.ftppass',
            auth: 'keyMain',
            remotePath: '/site/wwwroot'
        }));
}); 
我更喜欢使用auth方法,因为我不喜欢在gulp文件中公开用户和pwd,而是将.ftppass添加到我的.gitignore中

如果我在.ftppass文件中添加用户和pwd,并将任务更改为以下内容:

var sftp = require('gulp-sftp');        
gulp.task('sftp', function () {
        return gulp.src('dist/**/*')
            .pipe(sftp({
                host: 'waws-prod-sn1-015.ftp.azurewebsites.windows.net',
                user: 'fwd16\$fwd16',
                pass: 'xxxxxx',
                remotePath: '/site/wwwroot'
            }));
    });
bash-3.2$ gulp sftp                                                                                                                            
[22:29:18] Using gulpfile ~/Desktop/gulp-starter-csstricks/gulpfile.js                                                                         
[22:29:18] Starting 'sftp'...                                                                                                                  
[22:29:18] Authenticating with password.                                                                                                       
[22:29:28] 'sftp' errored after 10 s                                                                                                           
[22:29:28] Error in plugin 'gulp-sftp'                                                                                                         
Message:                                                                                                                                       
    Timed out while waiting for handshake                                                                                                      
Details:                                                                                                                                       
    level: connection-timeout                                                                                                                  
[22:29:28] gulp-sftp SFTP abrupt closure                                                                                                       
[22:29:28] Connection :: close
gulp.task('sftp', function () {
    return gulp.src('dist/**/*')
        .pipe(sftp({
            host: 'waws-prod-sn1-015.ftp.azurewebsites.windows.net',
            authFile:'.ftppass',
            auth: 'keyMain',
            remotePath: '/site/wwwroot'
        }));
}); 
我得到以下错误:

bash-3.2$ gulp sftp                                                                                                                            
[22:22:55] Using gulpfile ~/Desktop/gulp-starter-csstricks/gulpfile.js                                                                         
[22:22:55] Starting 'sftp'...                                                                                                                  
[22:22:55] 'sftp' errored after 7.52 ms                                                                                                        
[22:22:55] SyntaxError: Unexpected token $ in JSON at position 36                                                                              
    at Object.parse (native)                                                                                                                   
    at module.exports (/Users/sohail/Desktop/gulp-starter-csstricks/node_modules/gulp-sftp/index.js:33:25)                                     
    at Gulp.<anonymous> (/Users/sohail/Desktop/gulp-starter-csstricks/gulpfile.js:86:15)                                                       
    at module.exports (/Users/sohail/Desktop/gulp-starter-csstricks/node_modules/orchestrator/lib/runTask.js:34:7)                             
    at Gulp.Orchestrator._runTask (/Users/sohail/Desktop/gulp-starter-csstricks/node_modules/orchestrator/index.js:273:3)                      
    at Gulp.Orchestrator._runStep (/Users/sohail/Desktop/gulp-starter-csstricks/node_modules/orchestrator/index.js:214:10)                     
    at Gulp.Orchestrator.start (/Users/sohail/Desktop/gulp-starter-csstricks/node_modules/orchestrator/index.js:134:8)                         
    at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20                                                                                     
    at _combinedTickCallback (internal/process/next_tick.js:67:7)                                                                              
    at process._tickCallback (internal/process/next_tick.js:98:9)                                                                              
    at Module.runMain (module.js:592:11)                                                                                                       
    at run (bootstrap_node.js:394:7)                                                                                                           
    at startup (bootstrap_node.js:149:9)                                                                                                       
    at bootstrap_node.js:509:3
bash-3.2$gulp sftp
[22:22:55]使用gulpfile~/Desktop/gulp starter cstricks/gulpfile.js
[22:22:55]正在启动“sftp”。。。
[22:22:55]“sftp”在7.52毫秒后出错
[22:22:55]SyntaxError:位置36处JSON中的意外标记$
at Object.parse(本机)
在module.exports(/Users/sohail/Desktop/gulpstarter cstricks/node_modules/gulp sftp/index.js:33:25)
狼吞虎咽。(/Users/sohail/Desktop/gulpstartercstricks/gulpfile.js:86:15)
在module.exports(/Users/sohail/Desktop/gulpstarter cstricks/node_modules/orchestrator/lib/runTask.js:34:7)
在Gulp.Orchestrator.\u runTask(/Users/sohail/Desktop/gulpstarter cstricks/node\u modules/Orchestrator/index.js:273:3)
在Gulp.Orchestrator._runStep(/Users/sohail/Desktop/gulpstarter cstricks/node_modules/Orchestrator/index.js:214:10)
在Gulp.Orchestrator.start(/Users/sohail/Desktop/gulpstarter cstricks/node_modules/Orchestrator/index.js:134:8)
at/usr/local/lib/node_modules/gulp/bin/gulp.js:129:20
at_combinedTickCallback(内部/流程/下一步勾选js:67:7)
在进程中。_tick回调(内部/process/next_tick.js:98:9)
位于Module.runMain(Module.js:592:11)
运行时(bootstrap_node.js:394:7)
启动时(bootstrap_node.js:149:9)
在bootstrap_node.js:509:3
有人知道我在代码中遗漏了什么吗

-谢谢
Sohail

您必须查看此错误行: SyntaxError:JSON中的意外标记$36


json中的格式似乎不好。

您必须查看此错误行: SyntaxError:JSON中的意外标记$36

这在json中似乎是一种糟糕的格式