错误''标识符'territoryFromName'已经在使用Angular和Kendo UI的AOT构建中声明

问题描述 投票:3回答:3

最近,我们的包没有任何版本更改,我们的AOT构建失败并显示以下错误消息:

块供应商中的错误[初始] [名称] .bundle.js标识符 'territoryFromName'已经被宣布(13:9) }

function territoryFromName(name, identity) { var likelySubtags = __WEBPACK_MODULE_REFERENCE__7_636c6472__.supplemental.likelySubtags; var parts = name.split("-");

我们的package.json文件如下所示:

{
  "name": "frontend",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "build": "webpack --config webpack.config.js",
    "build:Production": "npm run fixmem && webpack --config webpack.config.prod.js --env.Production",
    "build:test": "webpack --config webpack.config.testAOT.js",
    "fixmem": "node increase-webpack-memory.js"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "5.2.5",
    "@angular/common": "5.2.5",
    "@angular/compiler": "5.2.5",
    "@angular/core": "5.2.5",
    "@angular/forms": "5.2.5",
    "@angular/http": "5.2.5",
    "@angular/platform-browser": "5.2.5",
    "@angular/platform-browser-dynamic": "5.2.5",
    "@angular/platform-server": "5.2.5",
    "@angular/router": "5.2.5",
    "@progress/kendo-angular-buttons": "4.1.2",
    "@progress/kendo-angular-dateinputs": "3.4.4",
    "@progress/kendo-angular-dialog": "3.6.2",
    "@progress/kendo-angular-dropdowns": "3.0.2",
    "@progress/kendo-angular-excel-export": "2.1.1",
    "@progress/kendo-angular-grid": "3.5.1",
    "@progress/kendo-angular-inputs": "3.2.0",
    "@progress/kendo-angular-intl": "1.4.1",
    "@progress/kendo-angular-l10n": "1.2.0",
    "@progress/kendo-angular-layout": "3.1.1",
    "@progress/kendo-angular-popup": "2.4.1",
    "@progress/kendo-angular-tooltip": "0.4",
    "@progress/kendo-angular-upload": "4.1.4",
    "@progress/kendo-data-query": "1.4.0",
    "@progress/kendo-drawing": "1.5.6",
    "@progress/kendo-ui": "2018.2.704",
    "@progress/telerik-angular-report-viewer": "3.18.125",
    "@telerik/kendo-intl": "1.3.2",
    "angular-tree-component": "7.1.0",
    "babel-polyfill": "6.9.1",
    "bootstrap": "4.0.0",
    "es6-shim": "0.35.3",
    "jquery": "3.2.1",
    "moment": "2.18.1",
    "moment-timezone": "0.5.13",
    "oidc-client": "1.4.1",
    "reflect-metadata": "0.1.10",
    "rxjs": "5.5.6",
    "zone.js": "0.8.12"
  },
  "devDependencies": {
    "@angular-devkit/core": "0.3.2",
    "@angular/cli": "1.7.4",
    "@angular/compiler-cli": "5.2.5",
    "@angular/language-service": "5.2.0",
    "@ngtools/webpack": "1.10.2",
    "@progress/kendo-theme-default": "2.54.0",
    "@types/jasmine": "2.8.3",
    "@types/jasminewd2": "2.0.2",
    "@types/node": "6.0.60",
    "aspnet-webpack": "3.0.0",
    "autoprefixer": "7.2.6",
    "circular-dependency-plugin": "4.4.0",
    "codelyzer": "4.0.1",
    "copy-webpack-plugin": "4.4.3",
    "cross-env": "5.0.5",
    "extract-text-webpack-plugin": "3.0.2",
    "file-loader": "1.1.11",
    "font-awesome": "4.7.0",
    "html-webpack-plugin": "2.30.1",
    "istanbul-instrumenter-loader": "3.0.1",
    "less-loader": "4.1.0",
    "npm-font-open-sans": "1.0.3",
    "popper.js": "1.14.3",
    "postcss-import": "11.1.0",
    "postcss-loader": "2.1.6",
    "postcss-url": "7.3.2",
    "raw-loader": "0.5.1",
    "rxjs-tslint": "0.1.5",
    "rxjs-tslint-rules": "4.7.2",
    "sass-loader": "6.0.7",
    "style-loader": "0.19.1",
    "stylus-loader": "3.0.2",
    "ts-node": "4.1.0",
    "tslint": "5.9.1",
    "tslint-clean-code": "0.2.3",
    "tslint-consistent-codestyle": "1.11.1",
    "tslint-eslint-rules": "5.0.0",
    "tslint-sonarts": "1.4.0",
    "typescript": "2.4.2",
    "uglifyjs-webpack-plugin": "1.2.7",
    "url-loader": "0.6.2",
    "webpack": "3.11.0",
    "webpack-cli": "3.0.8",
    "webpack-dev-server": "2.11.2"
  }
}

我们总是在任何构建之前刷新node_modules文件夹(nuke + npm install),并且最近出现错误(大约在2018-08-29上周一)。

自上次构建以来,我们没有对软件包版本进行任何更改。

没有AOT的构建仍然可以正常工作而没有任何错误。

如何解决这个错误?

angular build kendo-ui-angular2 angular2-aot
3个回答
16
投票

我也遇到了这个错误。我没有在package.json中安装@ telerik / kendo-intl。它被安装为版本@ 1.4.1的@ progress / kendo-angular-intl的依赖项。

我把@ telerik / kendo-intl安装到最新版本@ 1.4.2,这解决了我的错误。 @Nour - 如果你看一下@ 1.4.1和@ 1.4.2之间的区别,你会注意到Kendo团队删除了重复的声明。


4
投票

我一直在挖掘我的应用程序有什么问题,因为我没有做任何最近的更新,但仍然面临这个错误!

在文件里面:\node_modules\@telerik\kendo-intl\dist\es\cldr\territory.js

有一个territoryFromName函数的重复声明,只有name作为参数,另一个有两个参数nameidentity

第一个没有用,我只是从文件中删除并保存它,它工作得很好。

PS。我相信他们会很快解决这个问题,但是现在这对我有用了。


1
投票

只需从package.json文件中删除此行:

"@telerik/kendo-intl": "1.3.2",

经过一些研究,我们发现territoryFromName是在kendo-intl相关模块中定义的。

在kendo软件包中似乎存在一些依赖性混淆,看起来@telerik软件包只是重新定义了@progress kendo-angular更新的软件包的依赖关系。

根据我的理解,这与我们的@progress/kendo-angular-intl包装有冲突

© www.soinside.com 2019 - 2024. All rights reserved.