2016-10-28 8 views
1

gulp-sftpを使用してgulpタスクをセットアップし、2つのサイトで成功しなくても接続しようとしました。私はFilezillaで両方を試してみて、どちらも接続しています。gulp-sftp error on gulp-sftp

私のタスクは以下の通りです:

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ファイルでpwdを実行し、.gitignoreに.ftppassを追加します。

私は.ftppassファイル内のユーザーとPWDを追加し、次のようにタスクを変更する場合:私は次のエラーを取得する

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 

誰もが私が行方不明かを理解私のコード?

-thanks Sohail

答えて

0

あなたは、このエラーライン見直す必要があります。 にSyntaxError:36位

でJSONで予期しないトークン$それはJSONで悪いフォーマットと思われるが。

関連する問題