teambition / gulp-ssh

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

gulpssh.exec "npm install" keep hanging #11

Closed arashkay closed 9 years ago

arashkay commented 9 years ago

Firstly Thank You!

I am trying to automate my deployments and using: "gulp-ssh": "^0.3.3" and have something like this:

ssh.exec [ "cd /var/www/release_folder", "git pull", "npm install"], {filePath: 'gulp.ssh.log'}

Output:

[21:55:48] gulp-ssh :: Executing :: cd /var/www/release_folder
[21:55:49] gulp-ssh :: Executing :: npm install
[21:55:50] 'api:deploy' errored after 16 s
[21:55:50] Error in plugin 'gulp-ssh'
Message:
    npm

It keeps hanging and no error in my log file. Am I missing something? If I run the cd /var/www/release_folder && npm install command manually in my shell it works perfect.

zensh commented 9 years ago

exec can not change directory as this issue: https://github.com/mscdex/ssh2/issues/186

You should use shell method:

gulp.task('shell', function () {
  return gulpSSH
    .shell(['cd /home/thunks', 'git pull', 'npm install', 'npm update', 'npm test'], {filePath: 'shell.log'})
    .pipe(gulp.dest('logs'));
});
arashkay commented 9 years ago

Thanks! tested & perfect!