【发布时间】:2019-11-29 02:46:19
【问题描述】:
当生产构建项目在 Angular 4.4.4 上并且出现以下错误时,我收到以下错误。
在 5113:8 处缺少字体大小的警告。忽略。
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/home/mnt/.local/share/Trash/files/front_end/src'
ERROR in Error: Cannot determine the module for class AddWebsiteAndCampaign in /home/mnt/.local/share/Trash/files/front_end/src/app/campaign/campaign-main/campaign-main.component.ts! Add AddWebsiteAndCampaign to the NgModule to fix it.
Cannot determine the module for class CompanyEditComponent in /home/mnt/.local/share/Trash/files/front_end/src/app/company/company-edit/company-edit.component.ts! Add CompanyEditComponent to the NgModule to fix it.
at syntaxError (/home/mnt/.local/share/Trash/files/front_end/node_modules/@angular/compiler/bundles/compiler.umd.js:1729:34)
at analyzeAndValidateNgModules (/home/mnt/.local/share/Trash/files/front_end/node_modules/@angular/compiler/bundles/compiler.umd.js:24306:15)
at AotCompiler.analyzeModulesAsync (/home/mnt/.local/share/Trash/files/front_end/node_modules/@angular/compiler/bundles/compiler.umd.js:23937:46)
at CodeGenerator.codegen (/home/mnt/.local/share/Trash/files/front_end/node_modules/@angular/compiler-cli/src/codegen.js:32:14)
at Function.NgTools_InternalApi_NG_2.codeGen (/home/mnt/.local/share/Trash/files/front_end/node_modules/@angular/compiler-cli/src/ngtools_api.js:73:30)
at _donePromise.Promise.resolve.then (/home/mnt/.local/share/Trash/files/front_end/node_modules/@ngtools/webpack/src/plugin.js:428:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
当我使用 ng build --env=prod 时,生成的不是 build 但 build 不是生产版本,但是当我按照角度文档使用命令时 ng build --prod 发生上述错误。 我正在使用 ubuntu 18。
【问题讨论】:
标签: angular build angular-cli angular2-routing