Shivansh Khare
Shivansh Khare

Reputation: 93

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)

Upvotes: 9

Views: 15520

Answers (5)

Abdullah
Abdullah

Reputation: 2953

Below Solution work for me:

Step: 1

  • npm install @ionic/angular-toolkit@latest @ionic/cordova-builders

Step: 2

  • Replace below code in angular.json

  •      "builder": "@ionic/angular-toolkit:cordova-build",
    
  •      "builder": "@ionic/cordova-builders:cordova-serve",
    

enter image description here

Step: 3 - Not mandatory

  • Remove node_module and reinstall

Output enter image description here

Upvotes: 5

Leandro Ariel
Leandro Ariel

Reputation: 1391

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

Upvotes: 2

Shubham Pandey
Shubham Pandey

Reputation: 364

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

Upvotes: 26

afe
afe

Reputation: 535

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

Upvotes: 2

mani kandan
mani kandan

Reputation: 439

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

Upvotes: 2

Related Questions