简体   繁体   中英

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:

npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-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

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 . Try using ng serve if you are using cli to check if the application starts.

note - Angular 4 will support only TypeScript 2.1 . hope you have updated ts version

It's only a warn not error. You need also update zone.js to resolve this warn.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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