在nx工作区的根目录中,运行命令时
ng g lib my-lib
它产生了一个
服务
打电话
MyLibService
在一个
myLib/src/libs
文件夹中
我的工作区根目录
. 我希望它能创造一个新的
国际清算银行
里面
伦敦议会大厦
文件夹(
libs/my-lib/src
)(在我升级到V6之前,它经常这样做。)
也,
没有什么
添加到我的
angular.json
创建服务后的文件。
所以至少有三件事出错了:
-
生成工件的路径错误。
-
它正在生成一个
service
而不是
lib
-
没有任何记录
贾森
我做错什么了?
谢谢。
更新第1号
我创建了一个新的测试工作区,添加了一个应用程序,并使用与上面相同的命令向它添加了一个lib。一切按预期工作,所以我认为这意味着我的环境(包等)是正确的。我比较了虚拟工作区和实际工作区的angular.json文件,发现实际工作区缺少一个相关的条目:
"defaultCollection": "@nrwl/schematics"
.
我添加了这个条目,现在当我尝试创建一个lib时,它会在那里停留10-15秒,然后报告:
ERROR! test2/karma.conf.js does not exist..
ERROR! test2/ng-package.json does not exist..
ERROR! test2/ng-package.prod.json does not exist..
ERROR! test2/package.json does not exist..
ERROR! test2/tsconfig.lib.json does not exist..
ERROR! test2/tsconfig.spec.json does not exist..
ERROR! test2/tslint.json does not exist..
ERROR! test2/src/test.ts does not exist..
ERROR! test2/src/index.ts does not exist..
ERROR! test2/src/lib/test2.component.ts does not exist..
ERROR! test2/src/lib/test2.module.ts does not exist..
ERROR! libs/test2/src/lib/test2.module.ts does not exist..
ERROR! libs/test2/src/index.ts does not exist..
ERROR! libs/test2/tsconfig.lib.json does not exist..
ERROR! libs/test2/tsconfig.spec.json does not exist..
ERROR! libs/test2/tslint.json does not exist..
ERROR! libs/test2/karma.conf.js does not exist..
The Schematic workflow failed. See above.
“test2”是我试图创建的lib的名称
现在,在任何地方都不会创建任何内容,并且不会修改angular.json。
我将继续深入研究这个问题。