简体   繁体   中英

Error: Package "@ionic/angular-toolkit" has no builders defined

[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)

Try to install - npm install @ionic/cordova-builders

Then goto angular.json inside "ionic-cordova-build" and "ionic-cordova-serve" and replace

"builder": "@ionic/angular-toolkit:cordova-build"

with

"builder": "@ionic/cordova-builders:cordova-build" ,

For future references: here an explanation and how to fix it. I also needed to edit the angular.json to change the cordova builder.

I kicked out the issue by using this solution.

  1. run sudo npm install -g @ionic/cli@latest
    to install latest ionic package and run
    npm outdated
    to get outdated packages.
  2. run npm install package_name@latest --force (replace 'package_name' with the outdated package name) for every package shown in outdated package list
  3. Ignore any warning during update.


    TIP: Updating all the outdated packages saves you from app's low performance and improves security

Try to install - npm install @ionic/cordova-builders

Then goto angular.json and replace

@ionic/angular-toolkit

with


@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"
            }
          }
        }

Nice answer, to fix

Error: Could not find the '@ionic/angular-builders:cordova-build' builder's node package

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