简体   繁体   English

从Angular 2迁移到4时打字稿错误

[英]Typescript error when migrating from Angular 2 to 4

I'm looking to migrate my angular 2 project to angular 4. I ran the command: 我想将我的angular 2项目迁移到angular4。我运行了命令:

npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@latest typescript@latest --save npm install @ angular / {common,compiler,compiler-cli,core,forms,http,platform-b​​rowser,platform-b​​rowser-dynamic,platform-server,router,animations} @latest typescript @ latest --save

Found at this official link: http://angularjs.blogspot.in/2017/03/angular-400-now-available.html 在此官方链接中找到: http : //angularjs.blogspot.in/2017/03/angular-400-now-available.html

But then this typescript error shows up: 但是随后出现此打字稿错误:

├── @angular/animations@4.1.3 
├─┬ @angular/cli@1.0.0
│ └── typescript@2.2.2 
├── @angular/common@4.1.3 
├── @angular/compiler@4.1.3 
├─┬ @angular/compiler-cli@4.1.3  invalid
│ └─┬ @angular/tsc-wrapped@4.1.3 
│   └── tsickle@0.21.6 
├── @angular/core@4.1.3 
├── @angular/forms@4.1.3 
├── @angular/http@4.1.3 
├── @angular/platform-browser@4.1.3 
├── @angular/platform-browser-dynamic@4.1.3 
├─┬ @angular/platform-server@4.1.3 
│ ├── parse5@3.0.2 
│ └── xhr2@0.1.4 
├── @angular/router@4.1.3 
├── typescript@2.3.3  invalid
└── UNMET PEER DEPENDENCY zone.js@0.7.8

npm WARN @angular/core@4.1.3 requires a peer of zone.js@^0.8.4 but none was installed.

Its a warning telling to to install zone.js . 这是一个警告,告诉您要安装zone.js。 Try using ng serve if you are using cli to check if the application starts. 如果您使用cli检查应用程序是否启动,请尝试使用ng serve。

note - Angular 4 will support only TypeScript 2.1 . note-Angular 4仅支持TypeScript 2.1。 hope you have updated ts version 希望您已经更新了ts版本

It's only a warn not error. 这只是警告而不是错误。 You need also update zone.js to resolve this warn. 您还需要更新zone.js来解决此警告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM