Gulp 编译获取TS1005的TypeScript源时出错

xpcnnkqh  于 2022-12-08  发布在  Gulp
关注(0)|答案(1)|浏览(113)

我可以在VS 2022中运行我的应用程序,但当我尝试运行gulp并编译TypeScript源代码时,我会收到如下所有错误。我的tsconfig和包在下面,我不确定是否需要更改gulp脚本
C:/Web项目/ITF/Web/节点模块/类型脚本/库/lib.es6.d.ts(20624,14):错误TS 1005:应该是“;"。C:/Web项目/ITF/Web/节点模块/类型脚本/库/lib.es6.d.ts(20625,14):错误TS 1005:应该是“;"。C:/Web项目/ITF/Web/节点模块/类型脚本/库/lib.es6.d.ts(20626,14):错误TS 1005:应为“;"。
编译TypeScript源代码

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;
}));

ts配置

{
  "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"
  }
0sgqnhkj

0sgqnhkj1#

我只是猜测,但我看到你使用的是旧版本的gulp-typescript。你介意尝试一个新版本吗?当然,这可能会迫使你更新一些其他的软件包,以及,但问题可能与此软件包使用旧版本的tsc有关。请参阅-〉TypeScript error TS1005: ';' expected (II)

相关问题