ssilvert / keycloak-schematic

Schematic to add Keycloak support Angular CLI applications
Apache License 2.0
31 stars 5 forks source link

Unable to generate keycloak #8

Closed sebastienpattyn93 closed 6 years ago

sebastienpattyn93 commented 6 years ago

I followed the steps to integrate the keycloak schematic in my angular application but I keep getting the same error:

Schematic "keycloak" not found in collection "@schematics/angular".
Error: Schematic "keycloak" not found in collection "@schematics/angular".
    at SchematicEngine.createSchematic (/home/sebastien/dev/myApp/node_modules/@angular-devkit/schematics/src/engine/engine.js:155:23)
    at CollectionImpl.createSchematic (/home/sebastien/dev/myApp/node_modules/@angular-devkit/schematics/src/engine/collection.js:12:29)
    at Object.getSchematic (/home/sebastien/dev/myApp/node_modules/@angular/cli/utilities/schematics.js:36:23)
    at GenerateCommand.getOptions (/home/sebastien/dev/myApp/node_modules/@angular/cli/models/schematic-command.js:194:40)
    at GenerateCommand.<anonymous> (/home/sebastien/dev/myApp/node_modules/@angular/cli/commands/generate.js:38:53)
    at Generator.next (<anonymous>)
    at /home/sebastien/dev/myApp/node_modules/@angular/cli/commands/generate.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/home/sebastien/dev/myApp/node_modules/@angular/cli/commands/generate.js:3:12)
    at GenerateCommand.initialize (/home/sebastien/dev/myApp/node_modules/@angular/cli/commands/generate.js:30:16)

I have to tried to install everything as root and generate it is root but it is giving me the same errors.

ssilvert commented 6 years ago

I assume you were following these steps: npm install -g @ssilvert/keycloak-schematic ng generate keycloak --collection @ssilvert/keycloak-schematic --clientId=<clientName>

Try doing the npm install without the -g option.

ssilvert commented 6 years ago

I just discovered your problem. I upgraded Angular CLI and saw it.

sebastienpattyn93 commented 6 years ago

I have tried the install with and without the -g option in my Application folder as normal user and as root user, but it all gives me the same response

ssilvert commented 6 years ago

It looks like the --collection option no longer works. I have a workaround for now.

ng config cli.defaultCollection @ssilvert/keycloak-schematic ng generate keycloak --clientId=<clientName> ng config cli.defaultCollection @schematics/angular

sebastienpattyn93 commented 6 years ago

Thank you for your response. This worked for me, but since I'm on Angular 6 I just had to execute npm install rxjs-compat --save since it is missing since Angular 6.0.0. I was now able to launch myApp and got redirected to Keycloak

siavashoutadi commented 6 years ago

ng generate @ssilvert/keycloak-schematic:keycloak --clientId=myApp

ssilvert commented 6 years ago

Thanks siavashoutadi. I knew there must be a new way to do it, but I couldn't find one.

johnnylekwalo commented 5 years ago

thank you