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


Solution 1:[1]

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

Solution 2:[2]

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

Solution 3:[3]

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",

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 afe
Solution 2 mani kandan
Solution 3 Shubham Pandey