运行Angular Universal应用程序失败-韩元';t从单独的项目或服务中编译app.module.ts

运行Angular Universal应用程序失败-韩元';t从单独的项目或服务中编译app.module.ts,angular,angular-universal,Angular,Angular Universal,我正在尝试将我的Angular应用程序转换为Angular Universal SSR应用程序。 该项目在应用程序根目录下的项目文件夹(ng generate application)中包含一个单独的应用程序模块,该模块在主app.module.ts中导出,并包含在app-routing-module.ts中。应用程序在ng serve和添加universal support的情况下运行良好,未返回任何错误。 但是,当我在PowerShell中运行npm run build:ssr-和npm r

我正在尝试将我的Angular应用程序转换为Angular Universal SSR应用程序。 该项目在应用程序根目录下的项目文件夹(ng generate application)中包含一个单独的应用程序模块,该模块在主app.module.ts中导出,并包含在app-routing-module.ts中。应用程序在ng serve和添加universal support的情况下运行良好,未返回任何错误。 但是,当我在PowerShell中运行
npm run build:ssr-和npm run serve:ssr
时,会出现以下错误:

ERROR in src\app\app.module.ts(35,5): Error during template compile of 'AppModule'
  Could not resolve projects/{project name}/src/app/app.module relative to [object Object].. 
src/app/components/home/home.component.ts(2,30): error TS2307: Cannot find module 'src/app/services/xxx.service'.
src/app/app-routing.module.ts(3,40): error TS2307: Cannot find module 'projects/{project name}/src/app/app.module'.
src/app/components/xxx/xxx.component.ts(2,30): error TS2307: Cannot find module 'src/app/services/xxx.service'.
src/app/components/yyy/yyy.component.ts(2,30): error TS2307: Cannot find module 'src/app/services/xxx.service'.
src/app/components/qqq/qqq.component.ts(2,30): error TS2307: Cannot find module 'src/app/services/xxx.service'.
src/app/app.module.ts(7,40): error TS2307: Cannot find module 'projects/{project name}/src/app/app.module'.
问题不仅在于projects文件夹中的应用程序,还在于它无法在“normal”目录中找到唯一的服务。
如何解决这些问题?

请使用类似unix的相对导入路径,而不是绝对导入路径,例如,在
src/app/components/home/home.component.ts(2,30)
中,使用类似
。/path
的内容来
home.component.ts