I am facing a problem when uploading and updating files on an FTP server using vinyl-ftp in gulp.
My gulpfile.js code is:
var gutil = require('gulp-util');
var ftp = require('vinyl-ftp');
gulp.task( 'deploy-dev', function () {
var conn = ftp.create( {
host: 'my_server_host_name',
user: 'my_server_username',
password: 'my_server_password',
parallel: 5,
log: gutil.log
} );
var globs = [
'assets/**',
'!node_modules/**',
'!assets/img/**',
'!assets/bower_componets/**',
'!assets/dist/**'
];
// using base = '.' will transfer everything to /public_html correctly
// turn off buffering in gulp.src for best performance
return gulp.src( globs, { base: 'assets/', buffer: false } )
.pipe( conn.newer( '/public_html/demos/P-09-Sakha/html' ) ) // only upload newer files
.pipe( conn.dest( '/public_html/demos/P-09-Sakha/html' ) );
} );
// Default Task
gulp.task('default', [ 'scripts','css','watch', 'deploy-dev']);
And in my terminal I see the following error:
[16:58:12] Using gulpfile E:\xamp\htdocs\projects\P-09-sakha\html\gulpfile.js
[16:58:12] Starting 'scripts'...
[16:58:12] Starting 'css'...
[16:58:12] Starting 'watch'...
[16:58:12] Finished 'watch' after 74 ms
[16:58:12] Starting 'deploy-dev'...
[16:58:12] CONN
[16:58:12] CONN
[16:58:14] ERROR Error: Sorry, cleartext sessions are not accepted on this serve
r.
at makeError (E:\xamp\htdocs\projects\P-09-sakha\html\node_modules\vinyl-ftp
\node_modules\ftp\lib\connection.js:1067:13)
at Parser.<anonymous> (E:\xamp\htdocs\projects\P-09-sakha\html\node_modules\
vinyl-ftp\node_modules\ftp\lib\connection.js:113:25)
I would be highly obliged if anyone can help me in this regard.
Try setting the options secure
and secureOptions
:
var conn = ftp.create( {
host: 'my_server_host_name',
user: 'my_server_username',
password: 'my_server_password',
parallel: 5,
log: gutil.log,
secure: true,
secureOptions: {
rejectUnauthorized: false
}
} );