Error: connect ECONNREFUSED 10.208.26.206:21 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17)
this is the error i am getting. before the main project i was trying to deploy this on my server given from organisation but getting this error.
*code**
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var csso = require('gulp-csso');
var htmlmin = require('gulp-htmlmin');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
var gutil = require('gulp-util');
var ftp = require('vinyl-ftp');
//var GulpSSHDeploy = require('gulp-ssh-deploy').GulpSSHDeploy;
var styleSrc = './src/css/*.css';
var styleDest = './dist/css';
var jsSrc = './src/js/*.js';
var jsDest = './dist/js';
var pageSrc = './src/html/*.html';
var pageDest = './dist/html';
var styleWatch = './src/css/**/*.css';
var jsWatch = './src/js/**/*.js';
var pageWatch = './src/html/**/*.html';
var user = 'user';
var password = 'password';
var host = 'test-vm-xyz.xyz.xyz.in';
var port = 21;
var localFilesGlob = ['./src/**/*'];
var remoteFolder = './home/project/myApp/';
gulp.task('style', function () {
return gulp.src(styleSrc)
.pipe(csso())
.pipe(gulp.dest(styleDest))
});
gulp.task('js', function () {
return gulp.src(jsSrc)
.pipe(uglify())
.pipe(gulp.dest(jsDest));
});
gulp.task('page', function () {
return gulp.src(pageSrc)
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest(pageDest));
});
gulp.task('browser-sync', function () {
browserSync.init({
open:'external',
host: host,
proxy: 'http://' + host + ':' + port,
port: port,
notify: false,
ghostMode: false});
});
// helper function to upload a file
gulp.task('deploy', function () {
var conn = ftp.create({
host: host,
user: user,
password: password,
parallel: 10,
log: gutil.log});
console.log('Connecting to ' + host + ':' + port);
console.log('Uploading files to ' + remoteFolder);
console.log('Using user ' + user + ' with password ' + password);
return gulp.src(localFilesGlob, {base: './src', buffer: false})
.pipe(conn.newer(remoteFolder))
.pipe(conn.dest(remoteFolder));
});
gulp.task('ftp-deploy-watch', function () {
var conn = getFtpConnection();
return gulp.src(localFilesGlob, { base: './src', buffer: false })
.pipe(conn.newer(remoteFolder)) // only upload newer files
.pipe(conn.dest(remoteFolder));
});
gulp.task('watch', function () {
gulp.watch(styleWatch, gulp.parallel('style'));
gulp.watch(jsWatch, gulp.parallel('js'));
gulp.watch(pageWatch, gulp.parallel('page'));
// gulp.watch(GulpSSHDeploy.watch_files).on('change', reload);g
});
gulp.task('default', gulp.series('style','js','page', 'watch'),function(){
return console.log('Gulp is running...');
});