(编辑问题)升级包和依赖项后,
"typescript": "2.1.1"
"typings": "^0.8.1"
"zone.js": "^0.8.4"
"rxjs": "5.0.1"
使用upgrade命令将角度包升级到4.0.0没有帮助。我按照相同的顺序执行通常的npm run clean
,npm install
和npm run build
。我应该更改打字的版本吗?
ERROR in [default] node_modules/@angular/core/src/change_detection/differs/iterable_differs.d.ts:15:47
Cannot find name 'Iterable'.
ERROR in [default] /typings/browser/ambient/node/index.d.ts:426:10
Interface 'NodeBuffer' incorrectly extends interface 'Uint8Array'.
Types of property 'fill' are incompatible.
Type '(value: any, offset?: number, end?: number) => Buffer' is not assignable to type '(value: number, start?: number, end?: number) => this'.
Type 'Buffer' is not assignable to type 'this'.
答案 0 :(得分:0)
更新您的包裹,如下所示:
"dependencies": {
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@types/node": "~6.0.60",
"ts-node": "~2.0.0",
"typescript": "~2.2.0"
}
答案 1 :(得分:0)
在compipleroptions
中添加以下内容到tsconfig.json"compilerOptions": {
"skipLibCheck": true
}
答案 2 :(得分:0)
我尝试了很多其他用户的建议。以下是我最终解决/消除错误的方法:
ERROR in [default] node_modules/@angular/core/src/change_detection/differs/iterable_differs.d.ts:15:47
Cannot find name 'Iterable'.
要解决此问题,我通过typings install dt~core-js --global --save
安装了typings.core-js,然后在/// <reference path="../typings/index.d.ts" />
的顶部添加了main.ts
。这消除了Iterable
在升级到4.0.0的最后,我尝试将Typescript升级到^2.1.5
,但它产生了很多错误,所以我降级为2.0.3
(在其中一个中读取角度问题)帮助我成功运行npm install
和npm run build
。
由于我还在使用typings/ambient
,因此我遇到了关于升级到打字机1.x的this文章。我重新安装了正确版本的打字,最后能够成功构建
但是我在控制台中看到了routes
错误,因为我之前没有在我的路线中提到pathMatch: 'full'
。一旦我加入了pathMatch
字段,我就让应用程序正常运行。