Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.6.1版本有bug,只有文件夹传上去了,文件都没传上去 #69

Closed
Q956164483 opened this issue Jan 25, 2018 · 5 comments
Closed

Comments

@Q956164483
Copy link

Q956164483 commented Jan 25, 2018

/*
  yarn add gulp gulp-ssh
 */
const gulp = require('gulp')
const GulpSSH = require('gulp-ssh')

const remotePath = '/home/wwwroot/default/hyan_weixin/public/pages/h5/2018/0125zaosangrenhe'
const config = {
  sshConfig: { // 正式
      host: 'xxxxxx',
      port: 22,
      username: 'root',
      password: 'xxxxxx',
  },
  // sshConfig: { // 测试
  //   host: 'xxxxxx',
  //   port: 22,
  //   username: 'root',
  //   password: 'xxxxxx',
  // },
  remotePath: remotePath,
  commands: [
      // 删除现有文件
      `rm -rf ${remotePath}`
  ]
}
let gulpSSH = new GulpSSH({
  ignoreErrors: false,
  sshConfig: config.sshConfig
})
/**
 * 上传前先删除服务器上现有文件...
 */
gulp.task('execSSH', () => {
  console.log('删除服务器上现有文件...')
  return gulpSSH.shell(config.commands, {filePath: 'commands.log'})
      .pipe(gulp.dest('logs'))
});
/**
 * 上传文件到服务器
 */
gulp.task('deploy', ['execSSH'],() => {
  console.log('开始上传文件到服务器...')
  return gulp.src('./dist/**')
      .pipe(gulpSSH.dest(config.remotePath))
});

老铁,你昨天是不是更新插件了。。。昨天用的这个配置还能传,今天新建个项目,然后就传不了了,找了半天发现原来两个插件的版本不一样,结果来git一看,刚好就在20小时前更新了。。。,现在传到服务器的只有空文件夹,文件都没有,但是上传的时候上传的网速有几百k,就是文件都没上去,你们没这个问题?

@Q956164483
Copy link
Author

刚刚把插件回退到0.6.0就好了,因该可以确定是更新出问题了

@zensh
Copy link
Collaborator

zensh commented Jan 25, 2018

我自己测试了没问题,你的 deploy 写法错误,不能包在 setTimeout 中的 return

@Q956164483
Copy link
Author

上个版本真的没问题,也是这么写的,我试试不加定时器看看,谢谢了啊

@Q956164483
Copy link
Author

不加定时器也不行,上个版本还是可以。。。尴尬了。。。

@zensh
Copy link
Collaborator

zensh commented Jan 26, 2018

难道 dependencies 不同?全新安装 node modules 呢

@zensh zensh closed this as completed Jan 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants