gpt4 book ai didi

linux - : Cannot determine the module for class SomeComponent in/path to that component. ts 中的错误!将 SomeComponent 添加到 NgModule 以修复它

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:33:19 25 4
gpt4 key购买 nike

我有已经上线的 angular 6/node js 系统。所以现在我需要将最新的更改移动到实时服务器,然后再移动到开发服务器。两者都是相同的环境,即 Linux Server (RHEL7.6) 并且在工作窗口中

因此,当我在开发服务器中执行 ng build --prod 时出现此错误但 ng serve 会工作并且 ng build 会工作,并且我没有收到此错误在我的本地机器上,它是 Windows。我用谷歌搜索,发现一些区分大小写的可能是造成这种情况的原因,但我仔细检查了一下,我 100% 确定这不是这里的原因。我还引用了此页面 Cannot determine the module for class X in X.ts! Add X to the NgModule to fix it error in ionic2但这对我也没有帮助。该问题仅发生在已经存在的组件上,我只是更改了该组件的位置和一个组件名称。我将所有更改通过 winSCP 移动到开发服务器。感谢您的帮助。

最佳答案

这个问题是因为当我在本地更改组件的位置并使用 winscp 将整个文件夹移动到开发服务器时,在开发中组件将在新位置退出并且它会在旧位置存在,因为它不会被删除使用 winscp 移动文件夹时的文件。所以在不同的位置会有同名的组件,这就是这个问题的原因

Note :- There was no import code for this duplicate entry from old location in my app.module.ts (Angular Code where we import components) file still this issue occurred i don't know how and why.

从旧位置删除文件并尝试 ng build --prod 并且成功了。

关于linux - : Cannot determine the module for class SomeComponent in/path to that component. ts 中的错误!将 SomeComponent 添加到 NgModule 以修复它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53864256/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com