teambition / gulp-ssh

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

Question: Executing global modules? #57

Closed vernak2539 closed 7 years ago

vernak2539 commented 7 years ago

I've been trying to execute commands of global modules. Examples being npm and pm2. Both are installed on the host.

I've tried all of the following commands, but none have worked. When logging into the machine, these commands work

npm install --production, pm2 start, $(which pm2) start

Errors:

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: bash: npm: command not found
events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: bash: pm2: command not found
zensh commented 7 years ago

please use shell()

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

that worked, thank you @zensh