Issues with Gulp/SASS in older project

I have an older project that is still running Ionic V1, and I have been trying to troubleshoot an issue that’s going on with Gulp and SASS.

When I attempt to build the project, my CLI gives me this error:

Cannot load gulp: ReferenceError: primordials is not defined
Cannot run sass task: missing in gulpfile.js

Here is my current gulpfile.js:

var gulp = require('gulp');
var sass = require('gulp-sass');
var cleanCss = require('gulp-clean-css');
var rename = require('gulp-rename');

var paths = {
  sass: ['./scss/**/*.scss']
};

gulp.task('default', ['sass']);

gulp.task('sass', function(done) {
  gulp.src('./scss/ionic.app.scss')
    .pipe(sass())
    .on('error', sass.logError)
    .pipe(gulp.dest('./www/css/'))
    .pipe(cleanCss({
      keepSpecialComments: 0
    }))
    .pipe(rename({ extname: '.min.css' }))
    .pipe(gulp.dest('./www/css/'))
    .on('end', done);
});

gulp.task('watch', ['sass'], function() {
  gulp.watch(paths.sass, ['sass']);
});

After some searching, I thought it may be due to my environment running node v12.16.3, gulp 3.5.6 and @ionic/v1-toolkit v1.0.22.

I tried to upgrade my v1-toolkit to 3.2.15 my gulp to 4.0.2 and then updated my gulpfile.js to this (reference):

const gulp = require('gulp'),
  path = require("path"),
  sass = require('gulp-sass');

function sass() {
  return gulp.src('./scss/ionic.app.scss')
    .pipe(sass()).on('error', sass.logError)
    .pipe(gulp.dest('./www/css/'));
}

function watch(done) {
  gulp.watch(paths.sass, () => sass());

  if (done) done();
}

function watch(done) {
  gulp.watch(paths.sass, () => sass());

  if (done) done();
}

exports.sass = sass;
exports.watch = watch;
exports['ionic:serve:before'] = gulp.series(sass, watch); // Alias need need by @ionic/cli

But then I was receving this error:

SyntaxError: Identifier ‘sass’ has already been declared.

Any thoughts on what needs to be done in order to get gulp/sass to correctly work in a v1 project?

Anyone have any thoughts on this? I’m really stuck on options that don’t include a complete rewrite to Ionic 5.

Maybe align node version? Using nvm?

Newer node may not go well with old projects

Not using nvm, but from everything I saw that as long as I wasn’t using node 14+ then there shouldn’t be a problem with gulp 4.

Maybe I am missing something.