1

I have installed Visual Studio 2015 (with no other previous versions) on a new laptop and have pulled down the source for our MVC web app. We have a gulp file with tasks to compile our less and typescript.

When running this task ...

cmd.exe /c gulp -b "C:\Code\Trunk\MyProj\MyProj.Web" --color --gulpfile "C:\Code\Trunk\MyProj\MyProj.Web\Gulpfile.js" typescript

... I get the following error:

[09:43:16] Using gulpfile C:\Code\Trunk\MyProj\MyProj.Web\Gulpfile.js
[09:43:16] Starting 'typescript'...
[09:43:34] Plumber found unhandled error:
 Error: UNKNOWN, open 'C:\Code\Trunk\MyProj\MyProj.Web\app\allergy\main.js'
Process terminated with code 0.

Here is the task in the gulp file (with other parts removed for brevity):

var gulp = require("gulp");
var plumber = require("gulp-plumber");
var sourcemaps = require("gulp-sourcemaps");
var typescript = require("gulp-typescript");
var merge = require("merge2");

var paths = {
    typescript: {
        globpatterns: {
            all: "./Scripts/**/*.ts",
            excludedefinitions: "!./Scripts/**/*.d.ts"
        }
    }
};

gulp.task("typescript", function () {
    var result = gulp.src([
            paths.typescript.globpatterns.all,
            paths.typescript.globpatterns.excludedefinitions
        ])
        .pipe(plumber())
        .pipe(sourcemaps.init())
        .pipe(typescript({
            removeComments: true,
            declarationFiles: false,
            noImplicitAny: false,
            noEmitOnError: true,
            module: "amd",
            target: "ES5"
        }));

    return merge([
        result.js.pipe(gulp.dest("./")),
        result.pipe(sourcemaps.write()).pipe(gulp.dest("./"))
    ]);
});
  • My colleague has the same set-up as me and gets no error.
  • Typescript is set to version 1.0 in the project file (<TypeScriptToolsVersion>1.0</TypeScriptToolsVersion>) and I can't change this just now. I wondered if the reason was beacuse I don't have this version installed on my machine but my colleague doesn't either. C:\Program Files (x86)\Microsoft SDKs\TypeScript only has a folder for 1.7
  • I noticed that the task completes successfully if I remove either of the 2 lines with in the merge block.
  • It's a different .js file in the error message each time

I searched the web to see what the UNKNOWN error even means but couldn't find anything obvious / helpful. Anyone know how to fix this error? Or how I go about finding out why it's being thrown?

EDIT 20-Jan-2016

So, I was getting this error consistently for about a week ... and now it has stopped happening. I haven't made any changes to my development environment either. I'd like to leave this question open since I'm curious as to why this happened.

Gavin Sutherland
  • 1,496
  • 1
  • 20
  • 34

0 Answers0