【问题标题】:NestJs compiling Angular application while they are in different foldersNestJs 在不同文件夹中编译 Angular 应用程序
【发布时间】:2020-10-31 15:54:54
【问题描述】:

当前行为

使用 npm start 时,它还会在我的 dist 文件夹中编译我的 Angular 应用程序。这会导致出现此错误:

internal/modules/cjs/loader.js:983
  throw err;
  ^

Error: Cannot find module 'C:\Users\lecle\Desktop\Workspace\template\rest-api\dist\main'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

应用结构: 一个 www 文件夹,其中包含 NestJs 应用程序的 rest-api 文件夹和 Angular 的 webui 文件夹

预期行为

应该只编译我的nestjs应用程序

环境

Nest version: 7.1.5
 
For Tooling issues:
- Node version: 13.9.0
- Platform:  Windows


Others:
- Angular version: 9.1.12

【问题讨论】:

  • 你的 package.json 脚本是什么?是否有一个脚本用于编译应用程序的两个部分?
  • 原来是一个愚蠢的错误,我在我的 NestJs 应用程序中从 Angular 导入模块...

标签: angular nestjs


【解决方案1】:

错误是由我的 Angular 应用程序导入引起的。我在 Angular 中有相同的模块,并且导入链接到我的 Angular 应用程序。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-10-19
    • 1970-01-01
    • 2020-10-11
    • 2016-02-09
    • 2016-05-26
    • 2018-08-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多