Error - node_modules\@types\jasmine\index.d.ts(138,230) TS1005: ')' expected

Viewed 23060

Below is the versions i am using "@types/jasmine": "^2.8.9" "typescript": "~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"
      },

But still i am getting the below error

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.

I am not getting how to resolve this. Can anyone please help me.

6 Answers

If you are still having the issue, in package.json add

"typescript": "^2.9.2"

Run npm install.

It should work.

You have just change typescript@2.8.4 and @types/jasmine@2.8.3

Like

  1. npm install typescript@2.8.4 --save-dev
  2. npm install @types/jasmine@2.8.3 --save-dev

It's working 100%.

Thanks,

Try this: install ncu

npm install -g npm-check-updates

Update tsc easily:

ncu -u
npm install

That's it all, enjoy!.

  1. Step 1. You need to remove "~" before 2.8.6 or 2.8.9 in package.json
  2. Step 2. Remove the package-lock.json file and node_modules folder
  3. Step 3. Run "npm cache clean --force" and "npm install"

If you have reached this page when you are not using Jasmine anywhere in your application, then I would suggest checking your import statements on the top of your ts file. It should have this added on the top:

import { ConsoleReporter } from 'jasmine';

I saw this accidentally added on the top when I was using console object to log into the browser and the autocomplete feature of VS Code completed it with ConsoleReporter and this import statement was added. Removing this statement fixed my issue.

Related