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

Error : copy files ! #51

Open
bian17888 opened this issue Jun 3, 2016 · 19 comments
Open

Error : copy files ! #51

bian17888 opened this issue Jun 3, 2016 · 19 comments

Comments

@bian17888
Copy link

when I copied the files to remote server , I received the error messages ....

how can I solve this problem~ thx

===== gulp code =====
gulp.task('deploy:copy', ['deploy:clean'], function () {
return gulp
.src([conf.paths.dist + '/**'])
.pipe(gulpSSH.dest('/dist'));

===== error info =====
[17:43:31] Error in plugin 'gulp-ssh'
Message:
Failure
Details:
code: 4
lang:

@zensh
Copy link
Collaborator

zensh commented Jun 6, 2016

应该是这里错了 gulpSSH.dest('/dist'), 你没有该根目录的权限 /dist

@ta3pks
Copy link

ta3pks commented Jun 9, 2016

i have this same error seems plugin isn't working

@ta3pks
Copy link

ta3pks commented Jun 9, 2016

gulp.task("sendFile",["build"], _ => {
    return gulp.src("../stats_x86_64")
        .pipe(ssh.dest("/home/nikos/"));
})
gulp.task("deploy", ["sendFile"], _ => {
    return ssh.exec(["chmod a+x /home/nikos/stats_x86*","exit"]).pipe(gulp.dest("logs"))
})

here is my code

@zensh
Copy link
Collaborator

zensh commented Jun 10, 2016

gulp.src("../stats_x86_64/**/*")

@ta3pks
Copy link

ta3pks commented Jun 10, 2016

@zensh stats_x86_64 is an executable not a folder

@zensh
Copy link
Collaborator

zensh commented Jun 11, 2016

@NikosEfthias You should remove _ from => function

@ta3pks
Copy link

ta3pks commented Jun 11, 2016

it tells function will not have any parameters in es6 syntax what it has to do with ssh ?

@goldenratio
Copy link

I get the same error too

[14:50:36] 'deploy' errored after 4.35 s
[14:50:36] Error in plugin 'gulp-ssh'
Message:
    Failure
Details:
    code: 4
    lang:

My code,

gulp.task("deploy", function() {
    if(webDeployConfig.enabled)
    {
        var gulpSSH = new GulpSSH({
            ignoreErrors: true,
            sshConfig: {
                host: webDeployConfig.webserver,
                port: webDeployConfig.port,
                username: webDeployConfig.username,
                password: webDeployConfig.password
            }
        });

        return gulp.src(['target/**/*.*', '!target/**/*.ts', '!target/**/*.map'])
            .pipe(gulpSSH.dest(webDeployConfig.uploadDirectoryPath));
    }
    else
    {
        console.log("deploy is disabled!");
    }
});

@goldenratio
Copy link

goldenratio commented Jul 6, 2016

events.js:141
      throw er; // Unhandled 'error' event
      ^
 Error: Failure
    at SFTPStream._transform (F:\gulp-ssh\node_modules\ssh2\node_modules\ssh2-streams\lib\sftp.js:384:27)
    at SFTPStream.Transform._read (_stream_transform.js:167:10)
    at SFTPStream._read (F:\node_modules\gulp-ssh\node_modules\ssh2\node_modules\ssh2-streams\lib\sftp.js:170:15)
    at SFTPStream.Transform._write (_stream_transform.js:155:12)
    at doWrite (_stream_writable.js:300:12)
    at writeOrBuffer (_stream_writable.js:286:5)
    at SFTPStream.Writable.write (_stream_writable.js:214:11)
    at Channel.ondata (_stream_readable.js:542:20)
    at emitOne (events.js:77:13)
    at Channel.emit (events.js:169:7)

@ta3pks
Copy link

ta3pks commented Jul 7, 2016

@goldenratio theres no support for this plugin i guess i just used rsync with child_process.exec in my gulpfile if you are on a mac or linux machine you can also do the same thing i am not sure about mac but on linux rsync comes pre-installed

@goldenratio
Copy link

It seems the issue happens if I upload over 100 files or so.

@ta3pks
Copy link

ta3pks commented Jul 7, 2016

@goldenratio i tried to upload just a single binary about 30 mbytes

@goldenratio
Copy link

goldenratio commented Jul 7, 2016

could be related to this, mscdex/ssh2-streams#32
@zensh has to update plugin's dependencies

@zensh
Copy link
Collaborator

zensh commented Jul 7, 2016

@goldenratio
ssh2 should update it's dependencies~ https://github.com/mscdex/ssh2/blob/master/package.json#L8

@goldenratio
Copy link

@zensh created issue ticket mscdex/ssh2#448

@goldenratio
Copy link

@marco-koenen
Copy link

Are there any updates regarding this? Seems like it's still not working with a large number of files.

@WhereJuly
Copy link

Are there any updates regarding this? Seems like it's still not working with a large number of files.

Same issue here. Any solutions or workarounds anyone?

@WhereJuly
Copy link

WhereJuly commented Mar 29, 2021

I had to keep using gulp-ssh as the most effective solution for my deploy as I would not like to switch from Windows to linux or to pollute my machine with WSL for just one project, neither could I use the normal CI/CD instruments (e.g. Github Actions) due to the project in part comprises a heavy legacy codebase not suited for deploying from SVN.

So I had to find a workaround. That took some fresh thinking.

Here is it all from my Gulp deploy task:

  • Zip the built in advance code on my local dev machine with gulp-zip;

  • Upload the ziped code to a server with pscps utility from PuTTY package being run as a Windows CLI command using Node child_process.spawn.
    Of course I had to construct the PSCP command that sounded like that:
    pscp -r -i z:path\to\my\key\file\server.ppk "..\built\code\folder\zipped-deploy-version.zip" user@web-server-domain-or-ip.tld:/var/www/myproject/deploy/folder;

  • And then unzip it there with gulp-ssh exec executing somethng like cd /var/www/myproject/deploy/folder && unizip -o zipped-deploy-version.zip.

Hope that helps someone.

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

6 participants