我一直以為 ng update 就可以將 Angular 專案升級到最新版,試了幾次之後,專案還停留在原來版本,才知道事情沒那麼簡單。
在進行專案更新前,可以先 ng –version 看看,系統會告訴你專案目前的版本,如:
及執行 ng update 看看目前最新版的號碼,再進行更新
後來成功的作法,要先更新Global 的 CLI 版本,再 ng update 專案的版本,步驟如下:
- npm uninstall -g @angular/cli
- npm cache clean -f
- npm install -g @angular/cli@latest
- ng update @angular/cli
found 1 high severity vulnerability
run npm audit fix
to fix them, or npm audit
for details
- npm audit fix
- ng update @angular/core
found 1 high severity vulnerability
run npm audit fix
to fix them, or npm audit
for details
- npm audit fix