gpt4 book ai didi

node.js - 重复标识符错误 Popper.js

转载 作者:太空狗 更新时间:2023-10-29 17:57:04 24 4
gpt4 key购买 nike

我无法修复此错误或确定原因。没有代码发生变化,所以我认为这是更新 NPM 包的结果。这是控制台的错误日志。这是针对 Angular2 应用程序的。

ERROR in [at-loader] ./node_modules/@types/popper.js/index.d.ts:6:19 
TS2300: Duplicate identifier 'Popper'.

ERROR in [at-loader] ./node_modules/@types/popper.js/index.d.ts:89:15
TS2300: Duplicate identifier 'Popper'.

ERROR in [at-loader] ./node_modules/@types/popper.js/index.d.ts:104:3
TS2300: Duplicate identifier 'default'.

ERROR in [at-loader] ./node_modules/popper.js/index.d.ts:8:19
TS2300: Duplicate identifier 'Popper'.

ERROR in [at-loader] ./node_modules/popper.js/index.d.ts:113:15
TS2300: Duplicate identifier 'Popper'.

ERROR in [at-loader] ./node_modules/popper.js/index.d.ts:120:43
TS2694: Namespace 'Popper' has no exported member 'ReferenceObject'.

ERROR in [at-loader] ./node_modules/popper.js/index.d.ts:130:3
TS2300: Duplicate identifier 'default'.

这是我的 tsconfig.json 文件:

{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"../node_modules/@types/"
]
},
"compileOnSave": true,
"exclude": [
"node_modules/*",
"**/*-aot.ts"
]
}

这是您要求的我的 package.json 文件。我认为问题在于其中一个软件包正在升级到不稳定版本,因为我过去没有收到此错误:

{
"name": "truerec-verifier-landing-page",
"version": "1.0.0",
"description": "TrueRec verifier web.",
"scripts": {
"start": "webpack-dev-server --inline --progress --port 8080",
"test": "karma start karma.webpack.conf.js",
"build": "rm -rf dist/* && webpack --config config/webpack.prod.js --bail",
"dev": "rm -rf dist/* && webpack --config config/webpack.dev.js --bail"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/animations": "~4.1.1",
"@angular/common": "~4.1.1",
"@angular/compiler": "~4.1.1",
"@angular/compiler-cli": "~4.1.1",
"@angular/core": "~4.1.1",
"@angular/forms": "~4.1.1",
"@angular/http": "~4.1.1",
"@angular/platform-browser": "~4.1.1",
"@angular/platform-browser-dynamic": "~4.1.1",
"@angular/platform-server": "~4.1.1",
"@angular/router": "~4.1.1",
"@angular/tsc-wrapped": "~4.1.1",
"@angular/upgrade": "~4.1.1",
"angular-in-memory-web-api": "~0.3.1",
"angular2-recaptcha": "^0.4.1",
"core-js": "^2.4.1",
"jquery": "^3.2.1",
"js-sha3": "^0.5.7",
"ng2-pdf-viewer": "^1.1.0",
"ng2-semantic-ui": "^0.8.4",
"ng2-toastr": "^4.1.2",
"ngx-cookie": "^1.0.0",
"pdfjs-dist": "^1.8.430",
"rxjs": "5.0.1",
"zone.js": "0.8.12"
},
"devDependencies": {
"@types/google.analytics": "0.0.33",
"@types/jasmine": "2.5.36",
"@types/node": "^6.0.45",
"angular2-template-loader": "^0.6.0",
"awesome-typescript-loader": "^3.0.4",
"css-loader": "^0.26.1",
"extract-text-webpack-plugin": "2.0.0-beta.5",
"file-loader": "^0.9.0",
"html-loader": "^0.4.3",
"html-webpack-plugin": "^2.16.1",
"jasmine": "~2.4.1",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-phantomjs-launcher": "^1.0.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.1",
"less": "^2.7.2",
"less-loader": "^4.0.4",
"lodash": "^4.16.2",
"null-loader": "^0.1.1",
"phantomjs-prebuilt": "2.1.13",
"protractor": "~4.0.14",
"raw-loader": "^0.5.1",
"request": "^2.81.0",
"resolve-url-loader": "^2.0.2",
"rimraf": "^2.5.4",
"style-loader": "^0.13.1",
"to-string-loader": "^1.1.5",
"tslint": "^3.15.1",
"typescript": "~2.3.0",
"webpack": "2.2.1",
"webpack-dev-server": "2.4.1",
"webpack-merge": "^3.0.0"
},
"repository": {}
}

最佳答案

昨天,当我将一个存储库克隆到一台新机器上并执行 NPM 安装以获取软件包时,我遇到了同样的问题——完全相同的错误。我的项目也在使用 ng2-semantic-ui 包。 Ng2-semantic-ui 依赖于 Popper.js 和 @types\popper(typescript 定义)。

"dependencies": {
"@angular/common": "^4.1.0",
"@angular/core": "^4.1.0",
"@angular/forms": "^4.1.0",
"@types/popper.js": "^1.8.0",
"element-closest": "^2.0.2",
"popper.js": "^1.0.6",
"rxjs": "^5.0.1"
},

我能够将我的原始包与新包进行比较,我注意到 popper.js 现在包含了 typescript 定义 (index.d.ts)。看起来它们是在 1.11.1 中介绍的- 我的工作版本是 1.10.8,我的机器上是 1.12.1,构建版本“损坏”(与你的错误相同)。

错误和重复标识符的来源是 popper.js 的重复类型定义。

我将在 ng2-semantic-ui 上打开一个问题,看看我们是否可以删除对 @types/popper.js 的依赖,因为最新版本的 popper.js 不需要它。与此同时,我删除了 @types/popper.js 并且能够获得良好的构建。希望这对您有所帮助!

更新:这个问题看起来在 3 周前的版本 0.9.4(问题 195)(https://github.com/edcarroll/ng2-semantic-ui/releases/tag/v0.9.4)中的修补程序中得到解决。在 package.json 中更新你的依赖版本,你应该可以开始了。

关于node.js - 重复标识符错误 Popper.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45426016/

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