作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在关注这本书:https://github.com/manfredsteyer/schematics-sample
当我执行我的原理图时schematics .:my-comp
我收到以下错误:
An error occured:
Error: Schematic "my-comp" cannot resolve the factory.
at NodeModulesEngineHost.createSchematicDescription (/home/.../.npm-global/lib/node_modules/@angular-devkit/schematics-cli/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js:174:19)
at SchematicEngine.createSchematic (/home/.../.npm-global/lib/node_modules/@angular-devkit/schematics-cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:219:38)
at CollectionImpl.createSchematic (/home/.../.npm-global/lib/node_modules/@angular-devkit/schematics-cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:69:29)
at NodeWorkflow.execute (/home/.../.npm-global/lib/node_modules/@angular-devkit/schematics-cli/node_modules/@angular-devkit/schematics/src/workflow/base.js:99:38)
at main (/home/.../.npm-global/lib/node_modules/@angular-devkit/schematics-cli/bin/schematics.js:202:24)
at Object.<anonymous> (/home/.../.npm-global/lib/node_modules/@angular-devkit/schematics-cli/bin/schematics.js:293:5)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
export default function myComp(options: IFlexComponentOptions): Rule {
return (host: Tree, context: SchematicContext) => {
console.log("options before sanatize", options);
...
return rule(host, context);
};
}
{
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
"my-comp": {
"description": "This schematics generate an Angular Component on the current module or in an specified one",
"factory": "./my-comp/index#myComp"
}
}
}
最佳答案
我遇到了同样的问题,来自 export default function myComp
删除 default
.它应该工作。我关注同一本书。很多不兼容。
关于angular-schematics - 原理图 "my-comp"无法解析出厂,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55240762/
我是一名优秀的程序员,十分优秀!