错误编译打字稿来源获取TS1005

发布于 2025-02-05 15:15:24 字数 3828 浏览 1 评论 0原文

我可以在VS2022中运行我的应用程序罚款,但是当我尝试运行Gulp和编译打字稿来源时,我会遇到如下所示。我的tsconfig和软件包在下面

c:/webprojects/itf/web/node_modules/typescript/lib/lib.es6.d.ts(20624,14):错误ts1005:';';'';'预期的。 c:/webprojects/itf/web/node_modules/typescript/lib/lib.es6.d.ts(20625,14):错误ts1005:';;'预期的。 c:/webprojects/itf/web/node_modules/typescript/lib/lib.es6.d.ts(20626,14):错误ts1005:';';'预期。

编译打字稿来源

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
}

软件包

 "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"
  }

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"
  }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烂人 2025-02-12 15:15:24

我只是在猜测,但我看到您正在使用gulp-typecript的旧版本。您会介意尝试新版本吗?当然,这可能会迫使您更新其他软件包,但是问题可能与此软件包有关tsc的旧版本。参见 - > typescript错误ts1005:';';'预期(ii)

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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文