【发布时间】:2019-08-14 16:33:21
【问题描述】:
我检查了Collection “@schematics/angular” cannot be resolved ,它不是重复的。
我创建了自己的原理图,当我尝试使用 ng add @candiman/website@0.0.5-beta.3 使用它时,我遇到了以下错误。
我认为问题在于collection.json 没有打包并运送到npm package,因为ng-packgr 不包含JSON 文件
因此,物理 collection.json 不存在于 npm 包文件夹中,当原理图搜索 collection.json 文件时失败。
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 的原理图现在可以在npm 获得,如果有人想尝试一下。
angular库的源码可以在project source which publishes npm package with schematics找到
【问题讨论】:
-
问题未命名无法解决集合“@candiman/website”。你确定你在看正确的问题吗?
-
哦,我会改的。
-
我可以看看你的源代码吗?您尚未添加任何指向您的源代码或您的包中的网站的链接。
-
@Edric 也在更新问题
标签: angular angular-schematics