Rafael Augusto
Rafael Augusto

Reputation: 797

Schematic "library" not found in collection "@schematics/angular"

I'm getting the following error when trying to create a library in angular cli

Schematic "library" not found in collection "@schematics/angular".
Error: Schematic "library" not found in collection
"@schematics/angular".
    at SchematicEngine.createSchematic (/home/rafaelvicio/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:143:23)
    at CollectionImpl.createSchematic (/home/rafaelvicio/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/collection.js:12:29)
    at Object.getSchematic (/home/rafaelvicio/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/utilities/schematics.js:47:23)
    at Class.run (/home/rafaelvicio/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/tasks/schematic-get-options.js:12:40)
    at Class.beforeRun (/home/rafaelvicio/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/commands/generate.js:101:31)
    at Promise.resolve.then (/home/rafaelvicio/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:138:24)
    at <anonymous>

Command ng --version

shows this

Angular CLI: 1.7.4
Node: 8.9.3
OS: linux x64
Angular: 


node -v
v8.9.3

npm -v
5.5.1

Upvotes: 13

Views: 15260

Answers (5)

Thomas David Kehoe
Thomas David Kehoe

Reputation: 10960

I got this error when I tried to generate a service myService:

ng generate myService

This fixed the problem:

ng generate service myService

Why can't someone make a UNIX shell that does what I want, not what I type? :-)

Upvotes: 5

MagicLuckyCat
MagicLuckyCat

Reputation: 344

ng config cli.defaultCollection @ngrx/schematics

Upvotes: 0

Snackdex
Snackdex

Reputation: 742

npm i -g @schematics/angular 

updates you to the latest version of the schematic. Also important to update your angular cli:

npm i -g @angular/cli

Upvotes: 3

Joshua Craven
Joshua Craven

Reputation: 4565

This worked for me:

npm i @schematics/angular

Upvotes: 2

Abinesh Devadas
Abinesh Devadas

Reputation: 1547

Library support starts from Angular cli version 6 & above...

Please Check the release note for more information...

Upvotes: 2

Related Questions