teambition / gulp-ssh

SSH and SFTP tasks for gulp
184 stars 38 forks source link

gulp-ssh not working anymore #28

Closed senthanal closed 9 years ago

senthanal commented 9 years ago

Hi, gulp-ssh was working without troubles but after running npm install(npm install) breaks with error.


_stream_writable.js:313
    cb(er);
    ^
TypeError: object is not a function
    at onwriteError (_stream_writable.js:313:5)
    at onwrite (_stream_writable.js:335:5)
    at WritableState.onwrite (_stream_writable.js:105:5)
    at c:\_projekte\Products\WIGeoWeb3_ANWR\node_modules\gulp-ssh\node_modules\ssh2\node_modules\ssh2-streams\lib\sftp.js:2752:14
    at state.requests.(anonymous function).cb (c:\_projekte\Products\WIGeoWeb3_ANWR\node_modules\gulp-ssh\node_modules\ssh2\node_modules\ssh2-streams\lib\sftp.js:960:15)
    at SFTPStream._cleanup (c:\_projekte\Products\WIGeoWeb3_ANWR\node_modules\gulp-ssh\node_modules\ssh2\node_modules\ssh2-streams\lib\sftp.js:190:38)
    at SFTPStream.end (c:\_projekte\Products\WIGeoWeb3_ANWR\node_modules\gulp-ssh\node_modules\ssh2\node_modules\ssh2-streams\lib\sftp.js:160:8)
    at SFTPWrapper.end (c:\_projekte\Products\WIGeoWeb3_ANWR\node_modules\gulp-ssh\node_modules\ssh2\lib\SFTPWrapper.js:29:23)
    at WriteStream. (c:\_projekte\Products\WIGeoWeb3_ANWR\node_modules\gulp-ssh\index.js:175:20)
    at WriteStream.emit (events.js:129:20)

Seems like problem comes from the ssh2 node module. Any help would be great! Thanks for the nice gulp plugin :)

senthanal commented 9 years ago

I think, I found the answer. gulp-ssh works with ssh2-streams version 0.0.15 but not with 0.0.16 which is the latest as of I see from the dependency list of gulp-ssh. Could it be?

zensh commented 9 years ago

I have updated dependencies version. is it work for you?

betorobson commented 9 years ago

same problem here: _stream_writable.js:313 cb(er); ^ TypeError: object is not a function at onwriteError (_stream_writable.js:313:5) at onwrite (_stream_writable.js:335:5) at WritableState.onwrite (_stream_writable.js:105:5) at /Users/roberto/web/sautil.com.br/api/gulp/node_modules/gulp-ssh/node_modules/ssh2/node_modules/ssh2-streams/lib/sftp.js:2752:14 at state.requests.(anonymous function).cb (/Users/roberto/web/sautil.com.br/api/gulp/node_modules/gulp-ssh/node_modules/ssh2/node_modules/ssh2-streams/lib/sftp.js:960:15) at SFTPStream._cleanup (/Users/roberto/web/sautil.com.br/api/gulp/node_modules/gulp-ssh/node_modules/ssh2/node_modules/ssh2-streams/lib/sftp.js:190:38) at SFTPStream.end (/Users/roberto/web/sautil.com.br/api/gulp/node_modules/gulp-ssh/node_modules/ssh2/node_modules/ssh2-streams/lib/sftp.js:160:8) at SFTPWrapper.end (/Users/roberto/web/sautil.com.br/api/gulp/node_modules/gulp-ssh/node_modules/ssh2/lib/SFTPWrapper.js:29:23) at WriteStream. (/Users/roberto/web/sautil.com.br/api/gulp/node_modules/gulp-ssh/index.js:175:20) at WriteStream.emit (events.js:129:20)

zensh commented 9 years ago

It is bug comes from ssh2-streams@v0.0.16, ssh2-streams@0.0.15 work well. @mscdex

betorobson commented 9 years ago

Could you help me? What do I need to do?

zensh commented 9 years ago

You can cd gulp-ssh/node_modules/ssh2 && npm i ssh2-streams@0.0.15

zensh commented 9 years ago

I will try to fix ssh2-streams some time later

mscdex commented 9 years ago

Hello, let me know if this patch on top of master fixes things for you or not. Either way, it'd be good to have a test case for this.

zensh commented 9 years ago

@monkerek The patch work fine in gulp-ssh

betorobson commented 9 years ago

OK, ssh2-streams@0.0.15 it's working for me now. I made a postinstall file to fix it. It will install 0.0.15 after install package.json project.

Create a file called postinstall.js and copy the content bellow:

var exec = require('child_process').exec;
exec(
    'cd node_modules/gulp-ssh/node_modules/ssh2 && npm i ssh2-streams@0.0.15',
    function (err, stdout, stderr) {
        console.log(stdout);
        console.log(stderr);
    }
);

Add into your package.json this:

  "scripts": { 
    "postinstall" : "node ./postinstall.js"
  }

Run the install command again

$ npm install
zensh commented 9 years ago

@betorobson This issue will soon be fixed, @mscdex is ssh2's author

betorobson commented 9 years ago

That is grate, until it be fixed, I made the postinstall script for some members of my team which are not able to run some gulp taks that need sftp method working properly.

I'm waiting for this fix, thank you :)

mscdex commented 9 years ago

I've published a new version of ssh2-streams that has the fix I previously linked to.

betorobson commented 8 years ago

Thank you mscdex, it is working perfect. It solved my issue :)