无法编译角度项目

时间:2018-06-25 15:03:55

标签: angular typescript

错误:

  

PS C:\ toolbox \ intern-page> tsc C:\ toolbox \ intern-page \ src \ app \ homepage \ homepage.component.ts   node_modules/@types/core-js/index.d.ts:829:20-错误TS2304:找不到名称“ PromiseConstructor”。   829 const Promise:Promise构造函数;   node_modules/@types/core-js/index.d.ts:1486:36-错误TS2339:类型'SymbolConstructor'上不存在属性'for'。   1486 const _for:typeof core.Symbol.for;复制代码   node_modules/@types/core-js/index.d.ts:1490:43-错误TS2339:类型'SymbolConstructor'上不存在属性'hasInstance'。   1490 const hasInstance:typeof core.Symbol.hasInstance;复制代码   node_modules/@types/core-js/index.d.ts:1494:50-错误TS2339:类型'SymbolConstructor'上不存在属性'isConcatSpread'。   1494 const isConcatSpread:核心类型.Symbol.isConcatSpread;   node_modules/@types/core-js/index.d.ts:1502:38-错误TS2339:类型'SymbolConstructor'上不存在属性'keyFor'。   1502 const keyFor:typeof core.Symbol.keyFor;   node_modules/@types/core-js/index.d.ts:1506:37-错误TS2339:类型'SymbolConstructor'上不存在属性'match'。   1506 const match:typeof core.Symbol.match;   node_modules/@types/core-js/index.d.ts:1510:39-错误TS2339:类型“ SymbolConstructor”上不存在属性“替换”。   1510 const替换:typeof core.Symbol.replace;   node_modules/@types/core-js/index.d.ts:1514:38-错误TS2339:类型“ SymbolConstructor”上不存在属性“搜索”。   1514 const search:typeof core.Symbol.search;   node_modules/@types/core-js/index.d.ts:1518:39-错误TS2339:类型'SymbolConstructor'上不存在属性'species'。   1518 const种:typeof core.Symbol.species;   node_modules/@types/core-js/index.d.ts:1522:37-错误TS2339:类型'SymbolConstructor'上不存在属性'split'。   1522 const split:typeof core.Symbol.split;   node_modules/@types/core-js/index.d.ts:1526:43-错误TS2339:类型'SymbolConstructor'上不存在属性'toPrimitive'。   1526 const toPrimitive:核心类型.Symbol.toPrimitive;   node_modules/@types/core-js/index.d.ts:1530:43-错误TS2339:类型'SymbolConstructor'上不存在属性'toStringTag'。   1530 const toStringTag:typeof core.Symbol.toStringTag;   node_modules/@types/core-js/index.d.ts:1534:43-错误TS2339:类型'SymbolConstructor'上不存在属性'unscopables'。   1534 const unscopables:类型为core.Symbol.unscopables;   node_modules/@types/core-js/index.d.ts:2305:36-错误TS2339:类型'SymbolConstructor'上不存在属性'for'。   2305 const _for:typeof core.Symbol.for;   node_modules/@types/core-js/index.d.ts:2309:43-错误TS2339:类型'SymbolConstructor'上不存在属性'hasInstance'。   2309 const hasInstance:typeof core.Symbol.hasInstance;类型   node_modules/@types/core-js/index.d.ts:2313:50-错误TS2339:类型'SymbolConstructor'上不存在属性'isConcatSpread'。   2313 const isConcatSpread:核心类型.Symbol.isConcatSpread;   node_modules/@types/core-js/index.d.ts:2321:38-错误TS2339:类型'SymbolConstructor'上不存在属性'keyFor'。   2321 const keyFor:typeof core.Symbol.keyFor;   node_modules/@types/core-js/index.d.ts:2325:37-错误TS2339:类型“ SymbolConstructor”上不存在属性“匹配”。   2325 const match:typeof core.Symbol.match;   node_modules/@types/core-js/index.d.ts:2329:39-错误TS2339:类型“ SymbolConstructor”上不存在属性“替换”。   2329 const replace:typeof core.Symbol.replace;   node_modules/@types/core-js/index.d.ts:2333:38-错误TS2339:类型“ SymbolConstructor”上不存在属性“搜索”。   2333 const search:typeof core.Symbol.search;   node_modules/@types/core-js/index.d.ts:2337:39-错误TS2339:类型'SymbolConstructor'上不存在属性'species'。   2337 const种:typeof core.Symbol.species;   node_modules/@types/core-js/index.d.ts:2341:37-错误TS2339:类型'SymbolConstructor'上不存在属性'split'。   2341 const split:typeof core.Symbol.split;   node_modules/@types/core-js/index.d.ts:2345:43-错误TS2339:类型“ SymbolConstructor”上不存在属性“ toPrimitive”。   2345 const toPrimitive:核心类型.Symbol.toPrimitive;   node_modules/@types/core-js/index.d.ts:2349:43-错误TS2339:类型'SymbolConstructor'上不存在属性'toStringTag'。   2349 const toStringTag:类型为core.Symbol.toStringTag;   node_modules/@types/core-js/index.d.ts:2353:43-错误TS2339:类型'SymbolConstructor'上不存在属性'unscopables'。   2353 const unscopables:类型为core.Symbol.unscopables;   node_modules / rxjs / internal / Observable.d.ts:82:59-错误TS2693:“ Promise”仅引用类型,但在此处用作值。   82 toPromise(此:Observable,PromiseCtor:Proofise类型):Promise;   src / app / homepage / homepage.component.ts:9:14-错误TS1219:对装饰器的实验性支持是一项功能,在将来的版本中可能会更改。设置“ experimentalDecorators”选项以删除此警告。   9个导出类HomepageComponent实现OnInit {

package.json

{
  "name": "intern-page",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.3",
    "@angular/common": "^6.0.3",
    "@angular/compiler": "^6.0.3",
    "@angular/core": "^6.0.3",
    "@angular/forms": "^6.0.3",
    "@angular/http": "^6.0.3",
    "@angular/platform-browser": "^6.0.3",
    "@angular/platform-browser-dynamic": "^6.0.3",
    "@angular/router": "^6.0.3",
    "@types/core-js": "^2.5.0",
    "core-js": "^2.5.4",
    "rxjs": "^6.0.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.8",
    "@angular/cli": "~6.0.8",
    "@angular/compiler-cli": "^6.0.3",
    "@angular/language-service": "^6.0.3",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "gulp": "^3.9.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2"
  }
}

1 个答案:

答案 0 :(得分:0)

将所有文件与app_module分开,将它们放在新文件夹中。从那里打开cd到新文件夹,然后运行npm install以便重新开始。创建此项目时似乎出现了问题?您也可以只执行新的ProjectName,然后将文件移动到该新文件夹中。但是不清楚您是如何创建此项目的。