【发布时间】:2022-10-02 16:10:18
【问题描述】:
当我尝试通过运行以下代码在 Angular 14.7.13 应用程序中创建新组件时:
/f/JS/apps/myapp/src/app/board (main)
$ npx nx generate @nrwl/angular:component board --project=myapp --style=scss --no-interactive --verbose
我收到以下错误:
Error: The path provided for the component (src/app/board) does not exist under the project root (). Please make sure to provide a path that exists under the project root.
at checkPathUnderProjectRoot (F:\\JS\\apps\\myapp\\node_modules\\@nrwl\\angular\\src\\generators\\component\\component.js:34:15)
at F:\\JS\\apps\\myapp\\node_modules\\@nrwl\\angular\\src\\generators\\component\\component.js:14:9
at Generator.next (<anonymous>)
at F:\\JS\\apps\\myapp\\node_modules\\tslib\\tslib.js:118:75
at new Promise (<anonymous>)
at Object.__awaiter (F:\\JS\\apps\\myapp\\node_modules\\tslib\\tslib.js:114:16)
at componentGenerator (F:\\JS\\apps\\myapp\\node_modules\\@nrwl\\angular\\src\\generators\\component\\component.js:11:20)
at Object.<anonymous> (F:\\JS\\apps\\myapp\\node_modules\\nx\\src\\command-line\\generate.js:250:36)
at Generator.next (<anonymous>)
at fulfilled (F:\\JS\\apps\\myapp\\node_modules\\tslib\\tslib.js:115:62)
我在我希望 \'board\' 组件所在的文件夹中。
如果我在 /f/js/apps/myapp/ 的项目根目录中运行它没有区别,因为我得到了同样的错误。
根据此线程,这似乎是一个已知问题:https://github.com/nrwl/nx/issues/12042。见评论:
在等待修复发布时,您仍然可以通过使用要生成组件的项目名称指定 --project 标志来生成组件.提供路径时,此修复程序删除了此要求。
但我正在运行 --project=myapp?
谁能告诉我他们是否知道解决此问题的方法,好吗?
标签: javascript angular typescript angular-cli