gpt4 book ai didi

angular - Sweetalert 没有运行,我的 TS 文件出错

转载 作者:行者123 更新时间:2023-12-03 21:54:01 25 4
gpt4 key购买 nike

我正在维护一个使用 Angular 7.0.7 和 Node 10.20.1 的应用程序。
我工作正常,我很久以前安装了 Sweetalert 并且插件工作正常。昨天我的电脑重新启动,当我运行时 ng serve我收到这个错误

ERROR in node_modules/sweetalert2/sweetalert2.d.ts(277,39): error TS1005: ',' expected. node_modules/sweetalert2/sweetalert2.d.ts(277,68): error TS1011: An element access expression should take an argument. node_modules/sweetalert2/sweetalert2.d.ts(277,69): error TS1005: ';' expected. node_modules/sweetalert2/sweetalert2.d.ts(277,70): error TS1128: Declaration or statement expected. node_modules/sweetalert2/sweetalert2.d.ts(277,82): error TS1005: '(' expected.



我的 package.json 是这个
{
"name": "frontend",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"test2": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^7.0.4",
"@angular/cdk": "^7.3.0",
"@angular/common": "~7.0.0",
"@angular/compiler": "~7.0.0",
"@angular/core": "~7.0.0",
"@angular/forms": "~7.0.0",
"@angular/http": "~7.0.0",
"@angular/material": "^7.3.0",
"@angular/material-moment-adapter": "^9.2.3",
"@angular/platform-browser": "~7.0.0",
"@angular/platform-browser-dynamic": "~7.0.0",
"@angular/router": "~7.0.0",
"@fortawesome/fontawesome-free": "^5.13.0",
"@sweetalert2/theme-material-ui": "^3.1.4",
"bootstrap": "^4.2.1",
"core-js": "^2.5.4",
"devextreme": "^18.2.5",
"flagkit-web": "0.0.3",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"intro.js": "^2.9.3",
"ionicons": "^4.5.5",
"moment": "^2.25.3",
"ngx-bootstrap": "^5.5.0",
"ngx-toastr": "^10.0.4",
"pixeden-stroke-7-icon": "^1.2.3",
"rxjs": "~6.3.3",
"sweetalert2": "^9.14.0",
"xlsx": "^0.15.6",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.10.0",
"@angular/cli": "~7.0.5",
"@angular/compiler-cli": "~7.0.0",
"@angular/language-service": "~7.0.0",
"@types/intro.js": "^2.4.6",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"pe7-icon": "^1.0.4",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.1.6"
}
}

我做了很多把戏
  • 使用 npm install 删除并安装所有 node_modules , 不起作用
  • 我将 typescript 降级到 2.X 版本,没有用
  • 仅使用 npm uninstall sweetalert2 && npm install sweetalert2 重新安装了 Sweetalert , 不起作用
  • 我跑了npm audit fix , 我收到了很多关于应用程序的问题,没有用

  • 我去了sweetalert文件,在错误行上,我找到了这个代码
    /**
    * Provide an array of SweetAlert2 parameters to show multiple popups, one popup after another.
    *
    * @param steps The steps' configuration.
    */
    function queue<T>(steps: readonly (SweetAlertOptions | string)[]): Promise<T>;

    在所有情况下,是相同的错误...
    怎么了?

    最佳答案

    您好,我也开始面临同样的问题。在此期间找到了一个修复程序,直到出现更好的解决方案。我只是将其降级。检查它是否适合您。

    npm 安装 sweetalert2@v9.11.0

    关于angular - Sweetalert 没有运行,我的 TS 文件出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62136974/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com