错误 - node_modules \ @types \茉莉花\ index.d.ts(138230)TS1005: ')' 预期

问题描述 投票:4回答:5

下面是我使用“@类型/茉莉花”版本:“^ 2.8.9”“打字稿”:“〜2.6.2”

 "devDependencies": {
        "@ionic/app-scripts": "3.2.0",
        "@types/jasmine": "^2.8.9",
        "@types/node": "^10.12.5",
        "angular2-template-loader": "^0.6.2",
        "html-loader": "^0.5.5",
        "istanbul-instrumenter-loader": "^3.0.1",
        "jasmine": "^3.3.0",
        "jasmine-spec-reporter": "^4.2.1",
        "karma": "^3.1.1",
        "karma-chrome-launcher": "^2.2.0",
        "karma-coverage-istanbul-reporter": "^2.0.4",
        "karma-jasmine": "^1.1.2",
        "karma-jasmine-html-reporter": "^1.4.0",
        "karma-sourcemap-loader": "^0.3.7",
        "karma-webpack": "^3.0.5",
        "null-loader": "^0.1.1",
        "protractor": "^5.4.1",
        "ts-loader": "^3.5.0",
        "ts-node": "^7.0.1",
        "typescript": "~2.6.2"
      },

但我仍提示以下错误:

Error: node_modules/@types/jasmine/index.d.ts(138,47): error TS1005: ';' expected.
node_modules/@types/jasmine/index.d.ts(138,90): error TS1005: '(' expected.
node_modules/@types/jasmine/index.d.ts(138,104): error TS1005: ']' expected.
node_modules/@types/jasmine/index.d.ts(138,112): error TS1005: ',' expected.
node_modules/@types/jasmine/index.d.ts(138,113): error TS1136: Property assignment expected.
node_modules/@types/jasmine/index.d.ts(138,121): error TS1005: ')' expected.
node_modules/@types/jasmine/index.d.ts(138,147): error TS1005: '(' expected.
node_modules/@types/jasmine/index.d.ts(138,162): error TS1005: ']' expected.
node_modules/@types/jasmine/index.d.ts(138,163): error TS1005: ',' expected.
node_modules/@types/jasmine/index.d.ts(138,164): error TS1136: Property assignment expected.
node_modules/@types/jasmine/index.d.ts(138,165): error TS1136: Property assignment expected.
node_modules/@types/jasmine/index.d.ts(138,179): error TS1005: ',' expected.
node_modules/@types/jasmine/index.d.ts(138,183): error TS1005: ':' expected.
node_modules/@types/jasmine/index.d.ts(138,208): error TS1005: '{' expected.
node_modules/@types/jasmine/index.d.ts(138,217): error TS1005: ':' expected.
node_modules/@types/jasmine/index.d.ts(138,222): error TS1005: ',' expected.
node_modules/@types/jasmine/index.d.ts(138,227): error TS1005: ':' expected.
node_modules/@types/jasmine/index.d.ts(138,228): error TS1109: Expression expected.
node_modules/@types/jasmine/index.d.ts(138,230): error TS1005: ')' expected.

我没有得到如何解决这个问题。谁能帮帮我吗。

typescript jasmine karma-jasmine
5个回答
10
投票

如果您仍然有问题,在增加的package.json

“打字稿”: “^ 2.9.2”

运行安装NPM。

它应该工作。


3
投票

我有固定它改变了我的包版本:

"@types/jasmine": "2.8.6",
"@types/jasminewd2": "2.0.3",

公司成立于这个帖子:Angular 4+ : Sudden @types/jasmine error at runtime (npm start)


0
投票

试试这个:安装NCU

npm install -g npm-check-updates

轻松地更新TSC:

ncu -u
npm install

这一切,享受!


0
投票
  1. 第1步:您需要的package.json 2.8.6或2.8.9之前删除“〜”
  2. 步骤2.拆下包lock.json文件和文件夹node_modules
  3. 第3步:运行“NPM缓存清理--force”和“故宫安装”

0
投票

如果你当你不是在你的应用程序中使用茉莉花任何地方到达了该网页,那么我建议检查你的TS文件的顶部import语句。它应该有这种添加在上面:

import { ConsoleReporter } from 'jasmine';

我看到这个顶部不慎加入我使用控制台对象登录到浏览器和VS代码的自动完成功能时ConsoleReporter完成它,并加入这个import语句。删除此声明固定我的问题。


0
投票

你刚才改变[email protected]和@类型/茉莉@ 2.8.3

喜欢

  1. NPM安装[email protected] --save-dev的
  2. NPM安装@类型/茉莉@ 2.8.3 --save-dev的

它的工作100%。

谢谢,

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