Sweetalert没有运行,我在它的TS文件上得到一个错误的信息

问题描述 投票:0回答:1

我正在给一个应用程序与Angular 7.0.7和Node 10.20.1.我都工作得很好,我安装了很久以前Sweetalert和插件工作得很好。昨天,我的电脑重启,当我执行 ng serve 我得到了这个错误

node_modulessweetalert2sweetalert2.d.ts(277,39)中的错误:TS1005: ','预期。 node_modulessweetalert2sweetalert2.d.ts(277,68): 错误 TS1011: node_modulessweetalert2sweetalert2.d.ts(277,69): error TS1005: ';' expected. node_modulessweetalert2sweetalert2.d.ts(277,70): error TS1128: declaration or statement expected. node_modulessweetalert2sweetalert2.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"
  }
}

我做了很多手脚

  • 删除并安装了所有的node_modules,并将其与 npm install,没有工作
  • 我把typescript降到了2.X版本,但没有用。
  • 重新安装只有甜味剂与 npm uninstall sweetalert2 && npm install sweetalert2,没有工作
  • 我跑了 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>;

在所有的情况下,都是同样的错误......是什么问题?

angular typescript npm sweetalert2
1个回答
0
投票

你好,我也开始面临同样的问题。找到了一个修复的时间,直到一个更好的解决方案来了,我只是降级了。

npm安装[email protected]


-1
投票

很好,你只要把 "readonly "去掉,应用程序就可以工作了。

© www.soinside.com 2019 - 2024. All rights reserved.