TS2307:找不到模块(所有模块)- 移动文件夹后

TS2307: Cannot find module (all modules) - after moving folders

我决定移动文件夹以便按如下方式组织模块:

已自动更改 app.module.ts:

app.module.ts with important part of debug.log

但是,当我尝试使用 npm installng serve 时,我得到:

ERROR in : Can't resolve all parameters for EmployeesComponent in C:/Users/admin/Desktop/erp-mes-frontend/src/app/staff/employees/employees/employees.component.ts: (?, [object Object]).
src/app/staff/employees/employees/employees.component.ts(2,31): error TS2307: Cannot find module '../../services/employee.service'.
src/app/staff/employees/employees/employees.component.ts(4,24): error TS2307: Cannot find module '../../types'.
src/app/staff/teams/teams/teams.component.ts(3,27): error TS2307: Cannot find module '../services/team.service'.
src/app/staff/teams/teams/teams.component.ts(4,20): error TS2307: Cannot find module '../types'.
src/app/staff/teams/team/team.component.ts(2,27): error TS2307: Cannot find module '../services/team.service'.
src/app/staff/teams/team/team.component.ts(4,20): error TS2307: Cannot find module '../types'.
src/app/production/tasks/tasks/tasks.component.ts(2,27): error TS2307: Cannot find module '../services/task.service'.
src/app/production/tasks/tasks/tasks.component.ts(4,30): error TS2307: Cannot find module '../types'.
src/app/production/tasks/task/task.component.ts(2,27): error TS2307: Cannot find module '../services/task.service'.
src/app/production/tasks/task/task.component.ts(4,20): error TS2307: Cannot find module '../types'.
src/app/production/tasks/add-task/add-task.component.ts(2,36): error TS2307: Cannot find module '../../types'.
src/app/production/tasks/add-task/add-task.component.ts(3,27): error TS2307: Cannot find module '../../services/task.service'.
src/app/production/tasks/add-task/add-task.component.ts(5,31): error TS2307: Cannot find module '../../services/employee.service'.

等...

除了这个 IntelliJ 建议我:

TS2300: Duplicate identifier 'AppModule' in app.module.ts

和:

ng: Component 'AppComponent' is not included in a module and will not be available inside a template. Consider adding it to a NgModule declaration

或其他组件类似的错误,如:

ng: Can't resolve all parameters for TasksComponent in C:/Users/admin/Desktop/erp-mes-frontend/src/app/production/tasks/tasks/tasks.component.ts: (?, [object Object])

有人可以帮忙吗?

移动文件时,您必须确保更新所有文件引用以说明文件的新位置。您是否只是移动文件而不相应地更新它们?

转到 app.module.ts 和任何其他包含 imports/exports 的文件,并确保文件 URL 更新为新位置。

例如,import { Module } from './settings/module'; 必须更新为 import { Module } from './new_folder/settings/module'; 或其他适当的文件夹结构。

如果您使用的是 IDE,它应该会向您指出不正确的位置。