Thursday 20 April 2017

Gulp task keeps getting stuck

I've been using gulp to build my solution. One of the tasks as part of building the solution is to rename a folder ( from 'out/war/assets/viewModel' to 'out/war/assets/viewmodel'). However, in what I can only describe as a peculiar occurence, the task keeps getting stuck. Here's the gulp task for the build process:

gulp.task('war', ['clean:war'], function (cb) {
    sequence('copy:js', 'copy:static:deps', 'copy:static:assets', 'merge:commands', 'gzip', 'rename', cb);
});

Out of these processes, 'rename' keeps getting stuck (and I mean really stuck: doesn't complete at all). Here's the task definition:

gulp.task('rename', function (cb) {
    fs.rename('out/war/assets/viewModel', 'out/war/assets/viewmodel', cb);
});

Looks simple enough, right?

Here's the task definition of all the tasks preceding the 'rename' task:

const merge = require('merge2');

gulp.task('copy:js', function () {
    return gulp.src([
        _outDir + '/**',
        '!out/js/**/*spec.js',
        '!out/js/' + packagejson.name + '/src/**'],
        { base: _outDir })
        .pipe(gulp.dest('out/war'));
});

gulp.task('copy:static:deps', function () {
    return gulp.src(static_deps, { base: './node_modules/' + aw_decl_ui_framework })
        .pipe(gulp.dest('out/war'));
});

gulp.task('copy:static:assets', function () {
    var stream = merge();

    var nonPanelAssets = gulp.src(static_src, { base: './src' })
        .pipe(gulp.dest('out/war'));
    stream.add(nonPanelAssets);

    for (var ii = 0; ii < panelSrcPaths.length; ++ii) {
        var tmpStream = gulp.src(panelSrcPaths[ii])
            .pipe(flatten())
            .pipe(gulp.dest(panelDestPaths[ii]));
        stream.add(tmpStream);
    }
});

gulp.task('merge:commands', function () {
    return gulp.src('src/panels/**/commands/*.json')
        .pipe(mergeJson({
            fileName: 'allCommandsViewModel.json'
        }))
        .pipe(gulp.dest('out/war/assets/viewModel'));
});

gulp.task('gzip', function () {
    return gulp.src(gzip_src, { base: './out/war' })
        .pipe(gzip())
        .pipe(gulp.dest('out/war'));
});

The peculiar part? This process gets stuck only on my machine. The entire team can run this just fine , it runs greats on VM's, the Jenkins slave machine which runs the tests has no issues with it...It's just my machine that decides to freeze when this process runs. The only explanation I have for this behavior is that my machine is haunted. Unless I get another one for it :P

Specs: OS: Windows 7 Enterprise edition, 64 bit Memory: 16GB Node: v 6.10.2 LTS npm : v 3.10.10

Here are the dev-dependencies from the package.json

"devDependencies": {
    "@types/angular": "1.6.2",
    "@types/jasmine": "^2.5.43",
    "angular-mocks": "1.6.2",
    "body-parser": "1.14.1",
    "chai": "3.5.0",
    "chai-as-promised": "5.3.0",
    "compression": "1.6.0",
    "concurrently": "^3.3.0",
    "cookie-parser": "1.4.0",
    "cookie-session": "1.2.0",
    "cors": "2.7.1",
    "cucumber": "1.3.0",
    "del": "^2.2.2",
    "ejs": "2.4.2",
    "errorhandler": "1.4.2",
    "express": "4.13.3",
    "findup-sync": "^0.4.3",
    "gulp": "^3.9.1",
    "gulp-debug": "^3.1.0",
    "gulp-flatten": "^0.3.1",
    "gulp-gzip": "^1.4.0",
    "gulp-merge-json": "^1.0.0",
    "gulp-modify-file": "^0.1.0",
    "gulp-sourcemaps": "^2.4.1",
    "gulp-tslint": "^7.1.0",
    "gulp-typescript": "^3.1.4",
    "gulp-watch": "^4.3.11",
    "karma": "^1.5.0",
    "karma-coverage": "^1.1.1",
    "karma-jasmine": "^1.1.0",
    "karma-phantomjs-launcher": "^1.0.2",
    "karma-remap-istanbul": "^0.6.0",
    "karma-requirejs": "^1.1.0",
    "karma-spec-reporter": "0.0.30",
    "lite-server": "^2.2.2",
    "merge2": "^1.0.3",
    "method-override": "2.3.5",
    "morgan": "1.6.1",
    "path": "^0.12.7",
    "protractor": "5.1.1",
    "protractor-cucumber-framework": "1.0.1",
    "requirejs": "^2.3.3",
    "run-sequence": "^1.2.2",
    "selenium-webdriver": "3.3.0",
    "serve-favicon": "2.3.0",
    "sonar-tasks-ts": "latest",
    "splm-aw-bdd-framework": "latest",
    "splm-aw-decl-ui-mod": "1.0.20170315",
    "tslint": "^4.4.2",
    "typescript": "^2.1.6",
    "url": "^0.11.0"
  }

At first, I thought it was an issue with my HDD. So I got it checked, and it turns out that the HDD was corrupt. I got it replaced, and had everything set-up again. Imagine my surprise when this issue cropped up again.

Any pointers are appreciated.



via Shubhang

No comments:

Post a Comment