gpt4 book ai didi

angular - : Error: Internal error: unknown identifier {} 中的错误

转载 作者:行者123 更新时间:2023-12-04 02:41:06 25 4
gpt4 key购买 nike

我正在开发一个 Angular 应用程序。开发时一切正常,但是当我想使用以下方法构建生产版本时:

ng build --prod --aot

我收到以下错误:

> ng build --prod --aot

Browserslist: caniuse-lite is outdated. Please run next command `npm update`

Date: 2019-12-12T16:15:13.967Z
Hash: 3d59c47f3fb49f8e51cf
Time: 28553ms
chunk {0} runtime.741402d1d47331ce975c.js (runtime) 1.41 kB [entry] [rendered]
chunk {1} main.4af9b61479361f268d39.js (main) 128 bytes [initial] [rendered]
chunk {2} polyfills.d64fff5b0a45205ed7b5.js (polyfills) 130 bytes [initial] [rendered]
chunk {3} polyfills-es5.cae7692ec3ddfa1785ab.js (polyfills-es5) 68.1 kB [initial] [rendered]
chunk {4} styles.b944be682ec3583295e3.css (styles) 351 kB [initial] [rendered]

ERROR in : Error: Internal error: unknown identifier {}
at Object.importExpr$1 [as importExpr] (/Users/ilem0n/Projekte/Private/NGBudgetManager/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:25070:27)
at tokenExpr (/Users/ilem0n/Projekte/Private/NGBudgetManager/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:21548:43)
at depDef (/Users/ilem0n/Projekte/Private/NGBudgetManager/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:21554:76)
at /Users/ilem0n/Projekte/Private/NGBudgetManager/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:21544:68
at Array.map (<anonymous>)
at singleProviderDef (/Users/ilem0n/Projekte/Private/NGBudgetManager/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:21544:40)
at providerDef (/Users/ilem0n/Projekte/Private/NGBudgetManager/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:21470:13)
at /Users/ilem0n/Projekte/Private/NGBudgetManager/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:21644:81
at Array.map (<anonymous>)
at NgModuleCompiler.compile (/Users/ilem0n/Projekte/Private/NGBudgetManager/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:21644:48)
at AotCompiler._compileModule (/Users/ilem0n/Projekte/Private/NGBudgetManager/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:25015:36)
at /Users/ilem0n/Projekte/Private/NGBudgetManager/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:24934:70
at Array.forEach (<anonymous>)
at AotCompiler._compileImplFile (/Users/ilem0n/Projekte/Private/NGBudgetManager/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:24934:23)
at /Users/ilem0n/Projekte/Private/NGBudgetManager/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:24924:74
at Array.map (<anonymous>)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ng-budget@1.0.0 build:prod: `ng build --prod --aot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ng-budget@1.0.0 build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ilem0n/.npm/_logs/2019-12-12T16_15_14_106Z-debug.log

Process finished with exit code 1

我的配置:

Angular CLI: 8.3.20
Node: 12.10.0
OS: darwin x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.20
@angular-devkit/build-angular 0.803.20
@angular-devkit/build-optimizer 0.803.20
@angular-devkit/build-webpack 0.803.20
@angular-devkit/core 8.3.20
@angular-devkit/schematics 8.3.20
@angular/cdk 8.2.3
@angular/cli 8.3.20
@angular/flex-layout 8.0.0-beta.27
@angular/http 8.0.0-beta.10
@angular/material 8.2.3
@ngtools/webpack 8.3.20
@schematics/angular 8.3.20
@schematics/update 0.803.20
rxjs 6.5.3
typescript 3.5.3
webpack 4.39.2

我在网上发现了一些类似的问题,但没有一个对我有帮助。我在网上找到的

Angular Compiler throws Internal error: unknown identifier {}

ERROR in : Error: Internal error: unknown identifier []" when running ng build --prod

我没有可注入(inject)的父类(super class),也没有在我的项目中使用或导入 OpaqueToken。

任何想法如何解决这个问题?

最佳答案

想通了: 在我的每个功能中导入的共享模块中,我有以下行:

providers: [
{ provide: MAT_DIALOG_DATA, useExisting: {} }
]

在我删除这些之后,构建运行得非常好。

关于angular - : Error: Internal error: unknown identifier {} 中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59308871/

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