dasuchin / grunt-ssh-deploy

Grunt SSH Deployment
MIT License
66 stars 45 forks source link

ssh_deploy:prod -> Fatal error: must start with number, buffer, array or string #18

Closed betfold closed 9 years ago

betfold commented 9 years ago

Hi Have a simple conf:

environments: {
    prod: {
        options: {
              hosts: 'website.net',
              username: 'username',
              privateKey: require('fs').readFileSync('/path/to/id_rsa'),
              deploy_path: '/srv/www/mywebsite',
              local_path: 'dist',
         }
    }
}

When I launch grunt ssh_deploy:prod I got this error:

Running "ssh_deploy:prod" (ssh_deploy) task

Connecting :: website.net
Fatal error: must start with number, buffer, array or string

Best regard

betfold commented 9 years ago

Hi,

After looking, my issue is provided by ssh2, updating this to the latest version of ssh2 , and change file 'task/ssh_deploy.js'

--- a/package.json
+++ b/package.json
@@ -46,7 +46,7 @@
     "async": "^0.8.0",
     "extend": "^1.3.0",
     "moment": "^2.6.0",
-    "ssh2": "^0.2.22",
+    "ssh2": "^0.4.6",
     "scp2": "^0.1.4"
   }
 }
diff --git a/tasks/ssh_deploy.js b/tasks/ssh_deploy.js
index 34b1356..0f129a8 100644
--- a/tasks/ssh_deploy.js
+++ b/tasks/ssh_deploy.js
@@ -34,7 +34,7 @@ module.exports = function(grunt) {

     grunt.registerTask('ssh_deploy', 'Begin Deployment', function() {
         var done = this.async();
-        var Connection = require('ssh2');
+        var Connection = require('ssh2').Client;
         var client = require('scp2');
         var moment = require('moment');
         var timestamp = moment().format('YYYYMMDDHHmmssSSS');
@@ -249,4 +249,4 @@ module.exports = function(grunt) {
             });
         };
     });
-};
\ No newline at end of file
+};