本文介绍了如何从Angular 4更新/升级到Angular 5+的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将我的项目从Angular 4更新到Angular 5 +,

I need to update my project from Angular 4 to Angular 5+ ,

我需要将以下所有依赖项更改为Angular 5 +.

I need to change all following dependencies to Angular 5+.

我还将Angular CLI更新到1.5.0.

I also updated Angular CLI to 1.5.0.

我尝试创建新项目,但似乎只创建了Angular 4项目.

I tried to create new project but it seems to create only Angular 4 project.

"dependencies": {
  "@angular/animations": "^4.2.4",
  "@angular/common": "^4.2.4",
  "@angular/compiler": "^4.2.4",
  "@angular/core": "^4.2.4",
  "@angular/forms": "^4.2.4",
  "@angular/http": "^4.2.4",
  "@angular/platform-browser": "^4.2.4",
  "@angular/platform-browser-dynamic": "^4.2.4",
  "@angular/router": "^4.2.4",
  "core-js": "^2.4.1",
  "rxjs": "^5.4.2",
  "zone.js": "^0.8.14"
}

我在做什么错了.

CLI配置:

推荐答案

Node版本更新已解决的问题.

Problem fixed with Node version update.

我必须更新Node版本,

I had to update Node version,

sudo apt-get install nodejs

npm uninstall -g @angular/cli

npm cache clean

npm install -g @angular/cli@latest

ng new ProjectName

ng --version ==> 1.5.0

ng --version ==> 1.5.0

"dependencies": {
    "@angular/animations": "^5.0.0",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "rxjs": "^5.5.2",
    "zone.js": "^0.8.14"
}

这篇关于如何从Angular 4更新/升级到Angular 5+的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 08:49