Ionic-cli: Unable to generate a provider via the CLI (Ionic 4 ).

Created on 30 Jul 2018  路  4Comments  路  Source: ionic-team/ionic-cli

Description:
I'm using Ionic 4 and I've come across a snag in the CLI (what I believe), I'm Unable to generate a provider via the CLI.

Steps to Reproduce:
command for the CLI : ionic generate provider myprovider

Output:

ng generate provider asd
Schematic "provider" not found in collection "@ionic/schematics-angular".
Error: Schematic "provider" not found in collection "@ionic/schematics-angular".
at SchematicEngine.createSchematic (/home/prad/ionic/test/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:155:23)
at CollectionImpl.createSchematic (/home/prad/ionic/test/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/collection.js:12:29)
at Object.getSchematic (/home/prad/ionic/test/node_modules/@angular/cli/utilities/schematics.js:36:23)
at GenerateCommand.getOptions (/home/prad/ionic/test/node_modules/@angular/cli/models/schematic-command.js:194:40)
at GenerateCommand. (/home/prad/ionic/test/node_modules/@angular/cli/commands/generate.js:38:53)
at Generator.next ()
at /home/ionic/test/vemming/node_modules/@angular/cli/commands/generate.js:7:71
at new Promise ()
at __awaiter (/home/prad/ionic/test/node_modules/@angular/cli/commands/generate.js:3:12)
at GenerateCommand.initialize (/home/prad/ionic/test/node_modules/@angular/cli/commands/generate.js:30:16)
[ERROR] Could not generate provider.

My ionic info:

Ionic:

   ionic (Ionic CLI)          : 4.0.1 (/home/prad/Work/ionic/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.0
   @angular-devkit/core       : 0.7.0-rc.3
   @angular-devkit/schematics : 0.7.0-rc.3
   @angular/cli               : 6.0.8
   @ionic/ng-toolkit          : 1.0.0
   @ionic/schematics-angular  : 1.0.1

Cordova:

   cordova (Cordova CLI) : 7.1.0
   Cordova Platforms     : none

System:

   Android SDK Tools : 26.1.1
   NodeJS            : v8.11.3 (/home/prad/.nvm/versions/node/v8.11.3/bin/node)
   npm               : 5.6.0
   OS                : Linux 4.13

Environment:

   ANDROID_HOME : /home/prad/Android/Sdk

docs

Most helpful comment

they changed the provider into service. try ionic generate service

All 4 comments

they changed the provider into service. try ionic generate service

I suspected that and googled it, but didn't find anything. I was following a tutorial in the end around how to convert a ionic 3 to ionic 4 and it said provider. Thanks jospehlodero, I'll give that a shot.

I added a helpful error message about this change. It will be in 4.0.2. Thanks for the issue!

ionic generate service api/user

Was this page helpful?
0 / 5 - 0 ratings