如何修复:“资产路径必须从项目源根开始”?

发布于 2025-02-11 03:02:09 字数 177 浏览 0 评论 0 原文

我们有一个NRWL/NX项目,可以在Windows上构建,但它在Linux(CI Sytem)上失败。

错误是: /root/dev/apps/dmc-svr/src/资产资产路径必须从项目源根开始:apps \ dmc-svr \ src

它似乎是Windows/linux路径问题

We have an nrwl/nx project, that we can build on Windows, but it fails on Linux (Ci sytem).

The error is:
The /root/dev/apps/dmc-svr/src/assets asset path must start with the project source root: apps\dmc-svr\src

It seems to be a Windows/Linux path issue

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

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

发布评论

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

评论(2

美人迟暮 2025-02-18 03:02:09

问题是 sourceroot proterty in project.json 属性的窗口,

{
  "sourceRoot": "apps\\dmc-svr\\src",
  "targets": {
    "build": {
      "executor": "@nrwl/node:build",
      "options": {
        "assets": [
          "apps/dmc-svr/src/assets",
        ]
      }
    }
  }
}

修复程序就是简单地用slash \\ 代码> \ : sourceroot“:” apps/dmc-svr/src“

我们猜想这是由某些NX-Schema生成的。

The problem was a Windows like path for the sourceRoot property in project.json

{
  "sourceRoot": "apps\\dmc-svr\\src",
  "targets": {
    "build": {
      "executor": "@nrwl/node:build",
      "options": {
        "assets": [
          "apps/dmc-svr/src/assets",
        ]
      }
    }
  }
}

the fix is to simply replace the backslash \\ with a slash \: sourceRoot": "apps/dmc-svr/src"

We guess that this has been generated by some nx-schema.

情栀口红 2025-02-18 03:02:09

从Angular CLI迁移到NX时,我只是遇到了同样的问题。事实证明,我会切换分支, angular.json 文件迁移到NX后再次出现。它应该使用nx project.json 现在,因此删除 angular.json 文件已修复。

I've just has this same issue when migrating from the Angular CLI to NX. Turns out I'd switched branches and the angular.json file appeared again after migrating to NX. It should be using the NX project.json file now so deleting the angular.json file fixed it.

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