Task runner explorer VS2019 v16.6.2 failed to load Gulpfile.js

398 Views Asked by At

Here is the output error window result below.

Failed to run "D:\TortSVN\Oil Diversity\Main Web App\LatsetOildiversity\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
fs.js:27
const { Math, Object } = primordials;
                         ^
ReferenceError: primordials is not defined
    at fs.js:27:26
    at req_ (D:\TortSVN\Oil Diversity\Main Web App\LatsetOildiversity\node_modules\natives\index.js:143:24)
    at Object.req [as require] (D:\TortSVN\Oil Diversity\Main Web App\LatsetOildiversity\node_modules\natives\index.js:55:10)
    at Object.<anonymous> (D:\TortSVN\Oil Diversity\Main Web App\LatsetOildiversity\node_modules\graceful-fs\fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)

Only showed a part of the error here above. Here is my version for npm and gulp below.

PM> npm -v
6.14.4
PM> gulp -v
CLI version: 2.3.0
Local version: 4.0.2
PM> 

Here is my package.json content below.

{
  "name": "odg",
  "version": "1.0.0",
  "description": "OD",
  "main": "app/main.js",
  "keywords": [],
  "author": "Mohammad MalekMakan",
  "private": true,
  "devDependencies": {
    "grunt": "^1.0.3",
    "gulp": "3.9.0",
    "gulp-concat": "^2.5.2",
    "gulp-connect": "^5.0.0",
    "gulp-durandal": "^1.1.7",
    "gulp-jshint": "^2.0.4",
    "gulp-less": "^3.0.2",
    "gulp-livereload": "^3.8.0",
    "gulp-minify": "0.0.14",
    "gulp-minify-css": "^1.0.0",
    "gulp-server-livereload": "^1.2.1",
    "gulp-sourcemaps": "^1.5.1",
    "gulp-util": "3.0.4",
    "jshint": "^2.9.4",
    "jshint-stylish": "^2.2.1",
    "mout": "~1.0.0"
  },
  "dependencies": {
    "grunt-cli": "1.2.0",
    "natives": "^1.1.6"
  }
}

Here is the content of gulp.js file.

/// <binding Clean='build' />
var gulp = require('gulp');
var connect = require('gulp-connect');
var concat = require('gulp-concat');
var durandal = require('gulp-durandal');
var jshint = require('gulp-jshint');
var less = require('gulp-less');
var minifyCSS = require('gulp-minify-css');
var path = require('path');
var server = require('gulp-server-livereload');
var sourcemaps = require('gulp-sourcemaps');

gulp.task('copy', function() {
    gulp.src('auth-complete*')
        .pipe(gulp.dest('dist'));
});

gulp.task('js-watcher', function() {
    gulp.src('./app/**/*.js')
        .pipe(connect.reload());
});

gulp.task('less-watcher', function() {
    gulp.src('./styles/**/*.less')
        .pipe(connect.reload());
});

gulp.task('html-watcher', function() {
    gulp.src('./app/**/*.html')
        .pipe(connect.reload());
});

gulp.task('watch-all', ['analyze'], function(){
    gulp.watch(['./app/**/*.html'], ['html-watcher']);
    gulp.watch(['./app/**/*.js'], ['analyze', 'js-watcher']);
    gulp.watch(['./styles/**/*.less'], ['less', 'less-watcher']);
});   


gulp.task('default', [ 'analyze', 'less', 'connect', 'watch-all']);

gulp.task('build', ['analyze', 'less', 'durandal', 'copy']);

As i have searched plenty of solutions like this Gulpfile.js failed to load and this https://developercommunity.visualstudio.com/content/problem/961170/gulpfile-fails-to-load-after-upgrading-to-vs2019-1.html but nothing worked for me.

1

There are 1 best solutions below

0
Anushka Shukla On

Found the solution it's not working on VS2019 v16.6.2 but instead, it's working on VS2017 as i installed lower series. Here is a screenshot below
enter image description here