【问题标题】:Ionic v5 to v6 update failed?Ionic v5 到 v6 更新失败?
【发布时间】:2022-01-14 06:05:53
【问题描述】:

我有一个 ionic 5 项目,需要将其更新到 V6,我按照官方文档指南进行操作,但是当我尝试将 Angular 更新到最新版本时,它失败并出现以下错误,

C:\Users\Documents\WRepo>npx @angular/cli@13 update @angular/core@13 @angular/cli@13 The installed local Angular CLI version is older than the latest stable version. Installing a temporary version to perform the update. √ Package successfully installed. internal/modules/cjs/loader.js:892   throw err;   ^

Error: Cannot find module 'C:\Users\Documents\WRepo\'C:\Users\AppData\Local\Temp\angular-cli-packages-qTXpp3\node_modules\@angular\cli\bin\ng.js''
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47 {   code: 'MODULE_NOT_FOUND',   requireStack: [] }

是什么导致了这个错误,我怎样才能成功更新 ionic 版本?

提前致谢。

【问题讨论】:

    标签: angular ionic-framework angular-cli


    【解决方案1】:

    我认为 Ionic 更新文档不是太详细。这就是角度 CLI 的问题。您应该按照官方角度更新进行更新。

    https://update.angular.io/
    

    您要从哪个角度版本进行更新?如果这不起作用,请尝试删除 CLI 并清除缓存

    npm uninstall -g @angular/cli
    npm cache clean --force
    npm cache verify
    

    然后安装 CLI v13。

    【讨论】:

    • 这不起作用我仍然遇到同样的错误
    • 你使用的是哪个版本的 npm 和 node?你能试试最新的吗?
    • npm 7.5.x 节点 14 lts
    • 试试这个解决方案来升级 CLI。 stackoverflow.com/questions/43931986/…
    • 全局和本地更新 ng cli 并从项目中删除节点模块
    猜你喜欢
    • 2023-02-11
    • 2022-06-17
    • 2019-03-03
    • 2022-10-11
    • 2019-12-05
    • 1970-01-01
    • 2019-08-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多