1
votes

I'm just getting started with gulp in a .NET 4.6 project and I'm getting the error "Failed to load" in task runner explorer. My gulpfile is:

var gulp = require('gulp');
var inject = require('gulp-inject');
var concat = require('gulp-concat');
var print = require('gulp-print');

gulp.task('default', function () {
    console.log('Hello Gulp!');
});

gulp.task('css-task', function () {
    var target = gulp.src('./index.html');

    var customCssStream = gulp.src(['./bower_components/bootstrap/dist/css/bootstrap.min.css']);

    return target
        .pipe(inject(customCssStream.pipe(print())
        .pipe(concat('appStyles.css'))
        .pipe(gulp.dest('./Content/css')), { name: 'styles' }))
        .pipe(gulp.dest('./'));

});

And the error is:

gulp-inject/src/inject/index.js:127 startTag, ^ SyntaxError: Unexpected token , at exports.runInThisContext (vm.js:73:16) at Module._compile (module.js:443:25) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at require (module.js:384:17) at Object. (.../node_modules/gulp-inject/index.js:4:28) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10)

I was able to get the "Hello Gulp!" task to run, but once I add gulp-inject I see the problem.

1

1 Answers

1
votes

Turns out the problem was related to the version of node.js that Visual Studio 2015 installed not being compatible with node-inject module. After I installed version 4.4.2 of node.js and pointed visual studio at it as described here it now compiles.