gpt4 book ai didi

node.js - 带有 Webpack、Typescript 和 ES6 的 elastic-apm-node 不工作?

转载 作者:行者123 更新时间:2023-12-05 03:00:37 25 4
gpt4 key购买 nike

我正在使用带有 webpack 和 babel 的 TypeScript 设置,并在尝试包含 elastic-apm-node 时收到以下错误。我在环境变量中有设置。

import * as apm from 'elastic-apm-node/start'
apm.flush()

错误:

WARNING in node_modules/elastic-apm-node/lib/agent.js 152:16-59
Critical dependency: the request of a dependency is an expression
@ node_modules/elastic-apm-node/index.js

WARNING in node_modules/elastic-apm-node/lib/config.js 25:19-36
Critical dependency: the request of a dependency is an expression
@ node_modules/elastic-apm-node/lib/agent.js

WARNING in node_modules/elastic-apm-node/lib/instrumentation/index.js 169:16-30
Critical dependency: the request of a dependency is an expression
@ node_modules/elastic-apm-node/lib/agent.js

ERROR in node_modules/elastic-apm-node/lib/agent.js
Module not found: Error: Can't resolve '../package' in 'node_modules/elastic-apm-node/lib'
@ node_modules/elastic-apm-node/lib/agent.js 25:14-35

ERROR in node_modules/elastic-apm-node/lib/config.js
Module not found: Error: Can't resolve '../package' in 'node_modules/elastic-apm-node/lib'
@ node_modules/elastic-apm-node/lib/config.js 12:14-35

ERROR in node_modules/elastic-apm-http-client/index.js
Module not found: Error: Can't resolve './package' in 'node_modules/elastic-apm-http-client'
@ node_modules/elastic-apm-http-client/index.js 15:12-32

ERROR in node_modules/spdx-expression-parse/scan.js
Module not found: Error: Can't resolve 'spdx-exceptions' in 'node_modules/spdx-expression-parse'
@ node_modules/spdx-expression-parse/scan.js 6:17-43

ERROR in node_modules/spdx-correct/index.js
Module not found: Error: Can't resolve 'spdx-license-ids' in 'node_modules/spdx-correct'
@ node_modules/spdx-correct/index.js 17:21-48

ERROR in node_modules/spdx-expression-parse/scan.js
Module not found: Error: Can't resolve 'spdx-license-ids' in 'node_modules/spdx-expression-parse'
W20190619-11:37:30.394(2)? (STDERR) @ node_modules/spdx-expression-parse/scan.js 4:10-37

ERROR in node_modules/spdx-expression-parse/scan.js
Module not found: Error: Can't resolve 'spdx-license-ids/deprecated' in 'node_modules/spdx-expression-parse'
@ node_modules/spdx-expression-parse/scan.js 5:10-48

知道如何防止这种情况发生吗?当仅将 TypeScript 与 Meteor 一起使用时,我没有收到错误,所以我认为它与 Babel/Webpack 相关。

最佳答案

错误答案 - 我在 webpack.config.js 中有自定义 resole.extensions:

resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},

缺少默认的 .json:

resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json']
},

现在只剩下警告了:

WARNING in node_modules/elastic-apm-node/lib/agent.js 152:16-59
Critical dependency: the request of a dependency is an expression
@ node_modules/elastic-apm-node/index.js

WARNING in node_modules/elastic-apm-node/lib/config.js 25:19-36
Critical dependency: the request of a dependency is an expression
@ node_modules/elastic-apm-node/lib/agent.js

WARNING in node_modules/elastic-apm-node/lib/instrumentation/index.js 169:16-30
Critical dependency: the request of a dependency is an expression
@ node_modules/elastic-apm-node/lib/agent.js

我将它们发送给开发人员:https://github.com/elastic/apm-agent-nodejs/issues/1154

关于node.js - 带有 Webpack、Typescript 和 ES6 的 elastic-apm-node 不工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56665160/

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