如何将NG-Bootstrap安装到NX单声道存储库中?

发布于 2025-02-06 20:50:56 字数 321 浏览 4 评论 0原文

尝试使用NX将NG-Bootstrap安装到多项目单元存储库中时,我会收到以下错误:

npx ng add @ng-bootstrap/ng-bootstrap --project=web-app

The add command requires to be run in an Angular project, but a project definition could not be found.

我假设这是因为我正在使用project.json。这是一个角度项目,但没有角度。

When trying to install ng-bootstrap into a multi project mono repo using Nx I get the following error:

npx ng add @ng-bootstrap/ng-bootstrap --project=web-app

The add command requires to be run in an Angular project, but a project definition could not be found.

I am assuming this is because I am using project.json. It is an Angular project but without angular.json.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吃→可爱长大的 2025-02-13 20:50:56

好的,现在作为答案,我为您提供了这个答案:

  • 如果您安装了正确的NX和一个Angular Project,则应该有此消息:
PS D:\tests\nx\demo> ng add @ng-bootstrap/ng-bootstrap --project myapp
Ng add is not natively supported by Nx
Instead, we recommend running `npm install @ng-bootstrap/ng-bootstrap && npx nx g @ng-bootstrap/ng-bootstrap:ng-add`
√ Run this command? (y/N) · true

但是,这当然会失败,因为NX示意图没有处理 - 项目参数(有一个(有一个 猜PR要完成!

>  NX  Generating @ng-bootstrap/ng-bootstrap:ng-add

✔ Packages installed successfully.
SchematicsException [Error]: Unable to find project 'undefined' in the workspace

我 代码> ng添加命令来自适当目录。

Ok, now as an answer I have this for you :

  • If you installed properly Nx AND an Angular project, you should have this message :
PS D:\tests\nx\demo> ng add @ng-bootstrap/ng-bootstrap --project myapp
Ng add is not natively supported by Nx
Instead, we recommend running `npm install @ng-bootstrap/ng-bootstrap && npx nx g @ng-bootstrap/ng-bootstrap:ng-add`
√ Run this command? (y/N) · true

But of course this will fail because the Nx schematics did not handle the --project parameter (there is a PR to be done I guess !) :

>  NX  Generating @ng-bootstrap/ng-bootstrap:ng-add

✔ Packages installed successfully.
SchematicsException [Error]: Unable to find project 'undefined' in the workspace

So, for your particular case, I'd say you did not choose the Angular option when scaffolding the Nx workspace, or you migrated to project.json ... or you did not run the ng add command from the proper directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文