错误 TS2300:node_modules/@types/core-js/index.d.ts 中的重复标识符 'PropertyKey'

error TS2300: Duplicate identifier 'PropertyKey' in node_modules/@types/core-js/index.d.ts

我在 node_modules/@types/core-js/index.d.ts 在 Visual Studio 代码 IDE:

中有这些错误

当我 运行 npm start 为应用程序提供服务时,我得到:

    node_modules/@types/core-js/index.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'.
node_modules/@types/core-js/index.d.ts(85,5): error TS2687: All declarations of 'name' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(145,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.unscopables]' must be of type '{ copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: ...', but here has type 'any'.
node_modules/@types/core-js/index.d.ts(262,5): error TS2687: All declarations of 'flags' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(276,5): error TS2687: All declarations of 'EPSILON' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(311,5): error TS2687: All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(318,5): error TS2687: All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(457,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Symbol"', but here has type 'string'.
node_modules/@types/core-js/index.d.ts(457,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(464,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(492,5): error TS2687: All declarations of 'hasInstance' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(498,5): error TS2687: All declarations of 'isConcatSpreadable' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(504,5): error TS2687: All declarations of 'iterator' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(510,5): error TS2687: All declarations of 'match' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(516,5): error TS2687: All declarations of 'replace' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(522,5): error TS2687: All declarations of 'search' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(528,5): error TS2687: All declarations of 'species' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(534,5): error TS2687: All declarations of 'split' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(540,5): error TS2687: All declarations of 'toPrimitive' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(546,5): error TS2687: All declarations of 'toStringTag' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(552,5): error TS2687: All declarations of 'unscopables' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(609,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Math"', but here has type 'string'.
node_modules/@types/core-js/index.d.ts(609,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(613,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"JSON"', but here has type 'string'.
node_modules/@types/core-js/index.d.ts(613,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(628,5): error TS2687: All declarations of 'size' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(634,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(645,5): error TS2687: All declarations of 'size' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(651,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(666,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(680,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(692,5): error TS2687: All declarations of 'value' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(804,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/typescript/lib/lib.es2015.core.d.ts(17,14): error TS2300: Duplicate identifier 'PropertyKey'.

这是我的 tsconfig.json:

    {
  "compilerOptions": {
    "target": "es5",
    "module": "system",
    "moduleResolution": "node",
    "lib": ["es2015", "dom"],
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "outDir":"js/app/",
    "typeRoots": [
      "./node_modules/@types"
    ]
  },
    "exclude": [
    "node_modules",
    "app/test"
  ]
}

我的package.json

    {
  "name": "vepo",
  "version": "1.0.0",
  "scripts": {
    "coverage": "istanbul cover ./test.js",
    "lite-server-test": "lite-server --config=liteserver-test-config.json",
    "test": "karma start karma.config.js",
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" \"sass --watch app\" \"sass --watch index.scss\" \"sass --watch global-constants.scss\" ",
    "lite": "lite-server",
    "tsc": "tsc",
    "tsc:w": "tsc -w"
  },
  "bin":{
    "e2e-test-start": "bin/e2e-test-start.js" 
},
  "license": "ISC",
  "moduleResolution": "node",
  "dependencies": {
    "@angular/common": "~2.2.0",
    "@angular/compiler": "~2.2.0",
    "@angular/core": "~2.2.0",
    "@angular/forms": "~2.2.0",
    "@angular/http": "~2.2.0",
    "@angular/platform-browser": "~2.2.0",
    "@angular/platform-browser-dynamic": "~2.2.0",
    "@angular/router": "~3.2.0",
    "@angular/upgrade": "~2.2.0",
    "@types/bootstrap": "^3.3.32",
    "@types/core-js": "^0.9.34",
    "@types/google-maps": "^3.1.28",
    "@types/jasmine": "^2.5.38",
    "@types/jquery": "^2.0.34",
    "@types/node": "^6.0.51",
    "angular-in-memory-web-api": "~0.1.15",
    "angular2-google-maps": "^0.15.0",
    "angular2-modal": "^2.0.0",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "jquery": "v3.1.1",
    "jshint": "^2.9.4",
    "ng2-bs3-modal": "^0.10.4",
    "ng2-popover": "0.0.9",
    "protractor": "4.0.11",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "0.19.39",
    "tslint": "^4.0.2",
    "zone.js": "^0.6.25"
  },
  "devDependencies": {
    "@types/google-maps": "^3.1.28",
    "angular-mocks": "^1.5.8",
    "codelyzer": "1.0.0-beta.0",
    "concurrently": "^3.0.0",
    "core-js": "^2.4.1",
    "del": "latest",
    "gulp": "^3.9.1",
    "gulp-changed": "^1.3.2",
    "gulp-concat": "^2.6.1",
    "gulp-imagemin": "^3.1.1",
    "gulp-jshint": "^2.0.4",
    "gulp-minify-html": "^1.0.6",
    "gulp-sass": "latest",
    "gulp-sourcemaps": "latest",
    "gulp-strip-debug": "^1.1.0",
    "gulp-tslint": "latest",
    "gulp-typescript": "latest",
    "gulp-uglify": "^2.0.0",
    "istanbul": "^0.4.5",
    "jasmine": "~2.4.1",
    "karma": "latest",
    "karma-chrome-launcher": "latest",
    "karma-cli": "^1.0.1",
    "karma-coverage": "latest",
    "karma-htmlfile-reporter": "^0.3.4",
    "karma-jasmine": "latest",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-mocha-reporter": "latest",
    "karma-phantomjs2-launcher": "latest",
    "karma-story-reporter": "latest",
    "lite-server": "latest",
    "path": "latest",
    "phantomjs2": "latest",
    "protractor-jasmine2-html-reporter": "0.0.6",
    "require-dir": "latest",
    "systemjs-builder": "latest",
    "tslint": "latest",
    "typescript": "latest"
  }
}

我该如何解决这个问题?

**编辑:我曾经将 typings 用于 .d.ts 文件,但我转向了 @types。我还更新了我的 npm 和节点以尝试解决此问题:

{ app: '1.0.0',
  npm: '3.10.8',
  ares: '1.10.1-DEV',
  http_parser: '2.7.0',
  icu: '57.1',
  modules: '48',
  node: '5.something',
  openssl: '1.0.2j',
  uv: '1.9.1',
  v8: '5.1.281.84',
  zlib: '1.2.8' }

对此:

{ app: '1.0.0',
  npm: '4.0.2',
  ares: '1.10.1-DEV',
  http_parser: '2.7.0',
  icu: '57.1',
  modules: '48',
  node: '6.9.1',
  openssl: '1.0.2j',
  uv: '1.9.1',
  v8: '5.1.281.84',
  zlib: '1.2.8' }

npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@4.0.2
3 info using node@v6.9.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle vepo@1.0.0~prestart: vepo@1.0.0
6 silly lifecycle vepo@1.0.0~prestart: no script for prestart, continuing
7 info lifecycle vepo@1.0.0~start: vepo@1.0.0
8 verbose lifecycle vepo@1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle vepo@1.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/Ben/Development/vepo/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
10 verbose lifecycle vepo@1.0.0~start: CWD: /Users/Ben/Development/vepo
11 silly lifecycle vepo@1.0.0~start: Args: [ '-c',
11 silly lifecycle   'tsc && concurrently "npm run tsc:w" "npm run lite" "sass --watch app" "sass --watch index.scss" "sass --watch global-constants.scss" ' ]
12 silly lifecycle vepo@1.0.0~start: Returned: code: 2  signal: null
13 info lifecycle vepo@1.0.0~start: Failed to exec start script
14 verbose stack Error: vepo@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" "sass --watch app" "sass --watch index.scss" "sass --watch global-constants.scss" `
14 verbose stack Exit status 2
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:877:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid vepo@1.0.0
16 verbose cwd /Users/Ben/Development/vepo
17 error Darwin 16.1.0
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 error node v6.9.1
20 error npm  v4.0.2
21 error code ELIFECYCLE
22 error vepo@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" "sass --watch app" "sass --watch index.scss" "sass --watch global-constants.scss" `
22 error Exit status 2
23 error Failed at the vepo@1.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" "sass --watch app" "sass --watch index.scss" "sass --watch global-constants.scss" '.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the vepo package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     tsc && concurrently "npm run tsc:w" "npm run lite" "sass --watch app" "sass --watch index.scss" "sass --watch global-constants.scss"
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs vepo
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls vepo
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

"@types/core-js": "0.9.34" 升级到版本 0.9.39 对我有用。