Skip to main content
Gulp

Manually upgrade gulp from version 3 to 4 (Super Easy Guide with Examples)

By May 20, 2022May 22nd, 2022No Comments

The error that I was getting: ReferenceError: primordials is not defined

The guide that convinced me for the upgrade.

A few things to remember prior making the conversion, the task should be defined in advance. In other words, if we are referring the task first and let’s say it is defined in the later lines. That’s not going to work.

Most likely you would then see errors like the following

AssertionError [ERR_ASSERTION]: Task never defined: sass

Gulp 3

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

Gulp 4

1
gulp.task('default', gulp.series('sass', 'scripts'));

Gulp 3

1
2
3
gulp.task('scripts', function () {

});

Gulp 4

1
gulp.task('scripts', gulp.series(function () {

Gulp 3

1
2
gulp.task('git-check', function (done) {
});

Gulp 4

1
2
gulp.task('install', gulp.series('git-check', function () {
}))