cordova 错误:包“@ionic/angular-toolkit”未定义构建器

lstz6jyr  于 2022-11-15  发布在  Ionic
关注(0)|答案(4)|浏览(365)
[error] Error: Package "@ionic/angular-toolkit" has no builders defined.}
    at WorkspaceNodeModulesArchitectHost.resolveBuilder (C:\Users\Lenovo\Documents\krishikhoj\krishikhoj-ionic-app\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js:121:19)
    at RunCommand.runSingleTarget (C:\Users\Lenovo\Documents\krishikhoj\krishikhoj-ionic-app\node_modules\@angular\cli\models\architect-command.js:245:53)
    at async RunCommand.runArchitectTarget (C:\Users\Lenovo\Documents\krishikhoj\krishikhoj-ionic-app\node_modules\@angular\cli\models\architect-command.js:295:24)
    at async RunCommand.validateAndRun (C:\Users\Lenovo\Documents\krishikhoj\krishikhoj-ionic-app\node_modules\@angular\cli\models\command.js:136:22)
    at async runCommand (C:\Users\Lenovo\Documents\krishikhoj\krishikhoj-ionic-app\node_modules\@angular\cli\models\command-runner.js:224:24)
    at async default_1 (C:\Users\Lenovo\Documents\krishikhoj\krishikhoj-ionic-app\node_modules\@angular\cli\lib\cli\index.js:70:31)
8cdiaqws

8cdiaqws1#

尝试安装-npm安装@ionic/cordova-builders
然后转到“ionic-cordova-build”和“ionic-cordova-serve”中的angular.json,并替换
“构建器”:“@离子/Angular 工具包:cordova-构建”

“施工员”:“@离子/ cordova -助洗剂: cordova -助洗剂”

hgb9j2n6

hgb9j2n62#

供日后参考:here an explanation以及如何修复它。我还需要编辑angular.json来更改 cordova 构建器。

ufj5ltwl

ufj5ltwl3#

我用这个解决方案解决了这个问题。
1.运行sudo npm install -g @ionic/cli@latest
安装最新的离子软件包并运行
npm outdated
以获取过期的软件包。
1.运行npm install package_name@latest --force(替换'package_name'与过时的软件包名称)为每个软件包显示在过时的软件包列表
1.更新期间忽略任何警告。

提示: 更新所有过时的软件包可避免应用性能低下并提高安全性**

h22fl7wq

h22fl7wq4#

尝试安装- npm安装@离子/ cordova -建设者
然后后藤angular.json并替换

@ionic/angular-toolkit

@ionic/cordova-builders

The angular.json will be like this:

        "ionic-cordova-serve": {
          "builder": "@ionic/cordova-builders:cordova-serve",
          "options": {
            "cordovaBuildTarget": "app:ionic-cordova-build",
            "devServerTarget": "app:serve"
          },
          "configurations": {
            "production": {
              "cordovaBuildTarget": "app:ionic-cordova-build:production",
              "devServerTarget": "app:serve:production"
            }
          }
        },
        "ionic-cordova-build": {
          "builder": "@ionic/cordova-builders:cordova-build",
          "options": {
            "browserTarget": "app:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "app:build:production"
            }
          }
        }

相关问题