简体   繁体   中英

Error compiling TypeScript sources getting TS1005

I am able to run my application fine within VS2022 but when I try and run gulp and compile TypeScript sources I am getting all this errors like below. My tsconfig and package are below I am not sure if I need to change the gulp script

C:/WebProjects/ITF/Web/node_modules/typescript/lib/lib.es6.d.ts(20624,14): error TS1005: ';' expected. C:/WebProjects/ITF/Web/node_modules/typescript/lib/lib.es6.d.ts(20625,14): error TS1005: ';' expected. C:/WebProjects/ITF/Web/node_modules/typescript/lib/lib.es6.d.ts(20626,14): error TS1005: ';' expected.

Compile TypeScript sources

gulp.task("compile", gulp.series("clean", function () {
    const stream = gulp.src("./App/**/*.ts")
        .pipe(inlineNg2Template({
            base: "/",                  // Angular2 application base folder
            target: "es6",              // Can swap to es5
            indent: 2,                  // Indentation (spaces)
            useRelativePaths: false,     // Use components relative assset paths
            removeLineBreaks: false,     // Content will be included as one line
            templateExtension: ".html", // Update according to your file extension
            templateFunction: false    // If using a function instead of a string for `templateUrl`, pass a reference to that function here
        }))
        .pipe(typescript(tsProject))
        .pipe(ignore("References.js"))
        .pipe(gulp.dest("dist/App"));
    return stream;
}));

tsConfig

{
  "compilerOptions": {
    "target": "es5",
    "module": "amd",
    "moduleResolution": "node",
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "noEmitHelpers": false,
    "sourceMap": true,
    "noResolve": false,
    "noEmitOnError": true,
    "outDir": "dist/debug"
  },
  "filesGlob": [
    "./**/*.ts",
    "!./node_modules"
  ],
  "exclude": [
    "node_modules",
    "jspm_packages",
    "typings",
    "dist",
    "typings/*",
    "typings/main.d.ts",
    "typings/main",
    "Scripts"
  ],
  "compileOnSave": true,
  "buildOnSave": true
}

package

 "dependencies": {
    "@angular/cli": "^6.2.1",
    "@angular/common": "4.4.7",
    "@angular/compiler": "4.4.7",
    "@angular/core": "4.4.7",
    "@angular/forms": "4.4.7",
    "@angular/http": "4.4.7",
    "@angular/platform-browser": "4.4.7",
    "@angular/platform-browser-dynamic": "4.4.7",
    "@angular/router": "4.4.7",
    "@angular/upgrade": "4.4.7",
    "a": "^2.1.2",
    "angular-in-memory-web-api": "0.2.5",
    "core-js": "^2.4.1",
    "debug": "^4.1.1",
    "gulp": "^4.0.2",
    "gulp-cli": "^2.3.0",
    "gulp-typedoc": "^1.2.1",
    "gulp4-run-sequence": "^1.0.1",
    "moment": "2.17.1",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.4.3",
    "systemjs": "0.19.39",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "gulp-comment-swap": "0.0.10",
    "gulp-concat": "^2.6.0",
    "gulp-htmlclean": "^2.7.22",
    "gulp-ignore": "^2.0.1",
    "gulp-inject": "^5.0.5",
    "gulp-inline-ng2-template": "^5.0.1",
    "gulp-insert": "^0.5.0",
    "gulp-jspm": "^0.5.13",
    "gulp-rename": "^1.2.2",
    "gulp-replace": "^0.5.4",
    "gulp-rimraf": "^0.2.0",
    "gulp-shell": "^0.8.0",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-tslint": "^8.1.4",
    "gulp-tslint-stylish": "^1.1.1",
    "gulp-typescript": "^2.13.0",
    "gulp-uglify": "^3.0.2",
    "gulp-util": "^3.0.2",
    "gulp-watch": "^4.0.1",
    "highcharts": "^10.0.0",
    "html-loader": "^0.4.0",
    "immutable": "^3.8.1",
    "install": "^0.4.1",
    "json-loader": "^0.5.3",
    "moment": "^2.29.2",
    "npm": "^8.6.0",
    "redux": "^3.5.2",
    "rimraf": "^2.4.4",
    "run-sequence": "^1.1.5",
    "superstatic": "^7.1.0",
    "ts-loader": "^0.7.2",
    "tsc": "^1.20150623.0",
    "tsconfig-lint": "^0.12.0",
    "tslint": "^3.2.1",
    "tslint-loader": "^2.1.0",
    "typedoc": "^0.2.2",
    "typescript": "2.7.2",
    "typings": "^1.3.2"
  }

Im just guessing but I see that you are using an old version of gulp-typescript . Would u mind trying with a newer version? Of course, this might force you to update some other packages as well but the issue might be related to this package using an old version of tsc . See -> TypeScript error TS1005: ';' expected (II)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM