Ionic Info
Run ionic info from a terminal/cmd prompt and paste the output below.
ionic (Ionic CLI) : 4.4.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.16
@angular-devkit/build-angular : 0.10.7
@angular-devkit/schematics : 7.1.0
@angular/cli : 7.1.0
@ionic/angular-toolkit : 1.2.0
Cordova:
cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms : android 7.1.2, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.0.5, cordova-plugin-ionic-webview 2.0.0, (and 11 other plugins)
System:
NodeJS : v10.13.0 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS
Xcode : Xcode 10.1 Build version 10B61
Describe the Bug
Yesterday, I replaced @ionic/ng-toolkit and @ionic/schematics-angular with @ionic/angular-toolkit. When I serve the app, everything works as expected.
The problem occurs, when I build the App for iOS or Android at this step:
ng run app:ionic-cordova-build:production --platform=android
Steps to Reproduce
Steps to reproduce the behavior:
ionic cordova build android --prod --releaseExpected Behavior
The build works without problems as before.
Additional Context
List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to fix, Stack Overflow links, forum links, screenshots, OS if applicable, etc.
Stacktrace:
Could not find module "@ionic/ng-toolkit" from "/Users/carstenbaumhoegger/app".
Error: Could not find module "@ionic/ng-toolkit" from "/Users/carstenbaumhoegger/app".
at Object.resolve (/Users/carstenbaumhoegger/app/node_modules/@angular-devkit/core/node/resolve.js:141:11)
at Observable.rxjs_1.Observable [as _subscribe] (/Users/carstenbaumhoegger/app/node_modules/@angular/cli/node_modules/@angular-devkit/architect/src/architect.js:132:40)
at Observable._trySubscribe (/Users/carstenbaumhoegger/app/node_modules/rxjs/internal/Observable.js:44:25)
at Observable.subscribe (/Users/carstenbaumhoegger/app/node_modules/rxjs/internal/Observable.js:30:22)
at /Users/carstenbaumhoegger/app/node_modules/rxjs/internal/Observable.js:99:19
at new Promise (<anonymous>)
at Observable.toPromise (/Users/carstenbaumhoegger/app/node_modules/rxjs/internal/Observable.js:97:16)
at RunCommand.runSingleTarget (/Users/carstenbaumhoegger/app/node_modules/@angular/cli/models/architect-command.js:101:86)
at RunCommand.runArchitectTarget (/Users/carstenbaumhoegger/app/node_modules/@angular/cli/models/architect-command.js:128:35)
at RunCommand.run (/Users/carstenbaumhoegger/app/node_modules/@angular/cli/commands/run-impl.js:14:25)
[ERROR] An error occurred while running subprocess ng.
I found the solution by myself shortly after posting this.
The builder-option in angular.json has to be changed from ng-toolkit to angular-toolkit.
It would be nice if you could add this to the upgrade instructions for people, that are upgrading an existing app.
When you use @ionic/angular-toolkit as a dependency, you also need to update angular.json by replacing all occurrences of @ionic/ng-toolkit and @ionic/schematics-angular by @ionic/angular-toolkit.
Starting from apps created with v4.0.0-beta.13, nothing to do.
It would be nice if you could add this to the upgrade instructions for people, that are upgrading an existing app.
It should be documented at the bottom of the upgrade instructions you linked to (https://github.com/ionic-team/starters/pull/487#issue-220835980)
I realize upgrading apps is a little rocky, but we're still in beta and I hope to address changes like this using update schematics. See https://github.com/ionic-team/ionic-cli/issues/3686.
@abennouna is correct. This is the fix. Unless I'm missing something, this issue can be closed.
Most helpful comment
When you use
@ionic/angular-toolkitas a dependency, you also need to updateangular.jsonby replacing all occurrences of@ionic/ng-toolkitand@ionic/schematics-angularby@ionic/angular-toolkit.Starting from apps created with v4.0.0-beta.13, nothing to do.