I have checked Collection “@schematics/angular” cannot be resolved and it's not duplicate.
I have created my own schematics and when I try to use it using ng add @candiman/website@0.0.5-beta.3
I am getting below errors.
I think the problem is collection.json
not packaged and shipped to the npm package
as ng-packgr
does not include JSON
files
So, physical collection.json
is not present in the npm package folder and when schematics search for collection.json
file it fails.
Collection "@candiman/website" cannot be resolved.
Error: Collection "@candiman/website" cannot be resolved.
at NodeModulesEngineHost._resolveCollectionPath (/Users/aniruddh/aniruddh/develop/experiment/schematics-exp/sche-ex1/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:91:15)
at NodeModulesEngineHost.createCollectionDescription (/Users/aniruddh/aniruddh/develop/experiment/schematics-exp/sche-ex1/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js:111:27)
at SchematicEngine._createCollectionDescription (/Users/aniruddh/aniruddh/develop/experiment/schematics-exp/sche-ex1/node_modules/@angular-devkit/schematics/src/engine/engine.js:147:40)
at SchematicEngine.createCollection (/Users/aniruddh/aniruddh/develop/experiment/schematics-exp/sche-ex1/node_modules/@angular-devkit/schematics/src/engine/engine.js:140:43)
at AddCommand.getCollection (/Users/aniruddh/aniruddh/develop/experiment/schematics-exp/sche-ex1/node_modules/@angular/cli/models/schematic-command.js:123:35)
at AddCommand.runSchematic (/Users/aniruddh/aniruddh/develop/experiment/schematics-exp/sche-ex1/node_modules/@angular/cli/models/schematic-command.js:262:50)
at AddCommand.executeSchematic (/Users/aniruddh/aniruddh/develop/experiment/schematics-exp/sche-ex1/node_modules/@angular/cli/commands/add-impl.js:134:31)
at AddCommand.run (/Users/aniruddh/aniruddh/develop/experiment/schematics-exp/sche-ex1/node_modules/@angular/cli/commands/add-impl.js:105:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
@candiman/website@0.0.5-beta.3
with schematics is available in npm
now, if anyone wants to give a try.
The source code of the angular library can be found at project source which publishes npm package with schematics