1
votes

I'm receiving the following error,

  • I've tried changing my version of typescript, but this doesn't fix the issue.
  • I've tried running npm update --save and still nothing works.

    ERROR in [default] /Users/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:37 A parameter initializer is only allowed in a function or constructor implementation.

    ERROR in [default] /Users/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:45 Cannot find name 'keyof'.

    ERROR in [default] /Users/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:51 '=' expected.

Here is my package.json file.

{
  "name": "auction2",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "2.0.0",
    "@angular/compiler": "2.0.0",
    "@angular/core": "2.0.0",
    "@angular/forms": "2.0.0",
    "@angular/http": "2.0.0",
    "@angular/platform-browser": "2.0.0",
    "@angular/platform-browser-dynamic": "2.0.0",
    "@angular/router": "3.0.0",
    "core-js": "^2.4.1",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@types/jasmine": "^2.2.30",
    "angular-cli": "1.0.0-beta.16",
    "codelyzer": "~0.0.26",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "4.0.9",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "2.0.2"
  }
}
2

2 Answers

1
votes

You run a quick update for all packages and update the package.json file with updated versions, Follow these steps

  1. Delete the node_modules folder.
  2. Delete npm-cache from C:\Users\USERNAME\AppData\Roaming
  3. Open command prompt and navigate to root folder of your application.
  4. Check for the updates in npm packages using the command

    npm-check-updates -u
    
  5. Update all the packages and modify your package.json to current version using the command

    npm update --save
    

Also, update the npm packages globally using the command

npm install -g npm-check-updates

Hope this must fix your problem, if not let me know.

1
votes

ERROR in [default] /Users/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:45 Cannot find name 'keyof'.

keyof was introduced in Typescript 2.1, and in your package.json I see Typescript 2.0.2. I know you mentioned you upgraded Typescript, but maybe an even more recent version is needed.