Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

medianIndex is not exported from d3-array, causing import error in @antv/g2 #6479

Open
Hec-gitHub opened this issue Sep 27, 2024 · 4 comments

Comments

@Hec-gitHub
Copy link

Hec-gitHub commented Sep 27, 2024

问题描述

I encountered an error when trying to compile my project using @antv/g2. The error message is as follows:

Steps to Reproduce

  1. Install @antv/g2 and [email protected]
  2. Attempt to compile the project

Expected Behavior

The project should compile without errors.

Actual Behavior

The compilation fails with the error message mentioned above.

Environment

  • Node.js version: 18.20.4
  • @antv/g2 version: 5.2.5
  • d3-array version: 2.12.1

Additional Information

It appears that medianIndex is not exported from d3-array. Here is the output of Object.keys(require('d3-array')):
[
'Adder',
'InternMap',
'InternSet',
'ascending',
'bin',
'bisect',
'bisectCenter',
'bisectLeft',
'bisectRight',
'bisector',
'count',
'cross',
'cumsum',
'descending',
'deviation',
'difference',
'disjoint',
'every',
'extent',
'fcumsum',
'filter',
'fsum',
'greatest',
'greatestIndex',
'group',
'groupSort',
'groups',
'histogram',
'index',
'indexes',
'intersection',
'least',
'leastIndex',
'map',
'max',
'maxIndex',
'mean',
'median',
'merge',
'min',
'minIndex',
'nice',
'pairs',
'permute',
'quantile',
'quantileSorted',
'quickselect',
'range',
'reduce',
'reverse',
'rollup',
'rollups',
'scan',
'shuffle',
'shuffler',
'some',
'sort',
'subset',
'sum',
'superset',
'thresholdFreedmanDiaconis',
'thresholdScott',
'thresholdSturges',
'tickIncrement',
'tickStep',
'ticks',
'transpose',
'union',
'variance',
'zip'
]
Please provide guidance on how to resolve this issue.

重现链接

No response

重现步骤

No response

预期行为

No response

平台

  • 操作系统: Linux

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@hustcc
Copy link
Member

hustcc commented Sep 27, 2024

use d3-array@^3

@Hec-gitHub
Copy link
Author

Hec-gitHub commented Sep 27, 2024

use d3-array@^3

Thank you very much for re.I'll try.

@Hec-gitHub
Copy link
Author

use d3-array@^3

I tried to install version 3.2.4 and the above error was resolved, but another error occurred while compiling the project.
The specific compilation error is as follows:

`- info Creating an optimized production build

  • info Compiled successfully
  • info Skipping validation of types
  • info Linting ..- warn The Next.js plugin was not detected in your ESLint configuration. See https://nextjs.org/docs/basic-features/eslint#migrating-existing-config
  • info Linting ...- error ESLint: Error while loading rule '@typescript-eslint/no-unused-expressions': structuredClone is not defined Occurred while linting /data/git/DB-GPT/web/app/chat-context.tsx
  • info Linting
  • info Collecting page data ...Error [ERR_REQUIRE_ESM]: require() of ES Module /data/git/DB-GPT/web/node_modules/d3-array/src/index.js from /data/git/DB-GPT/web/node_modules/@antv/g2/lib/transform/utils/order.js not supported.
    Instead change the require of index.js in /data/git/DB-GPT/web/node_modules/@antv/g2/lib/transform/utils/order.js to a dynamic import() which is available in all CommonJS modules.
    at Object. (/data/git/DB-GPT/web/node_modules/@antv/g2/lib/transform/utils/order.js:4:20)
    at Object. (/data/git/DB-GPT/web/node_modules/@antv/g2/lib/transform/stackY.js:6:17)
    at Object. (/data/git/DB-GPT/web/node_modules/@antv/g2/lib/transform/maybeStackY.js:4:18)
    at Object. (/data/git/DB-GPT/web/node_modules/@antv/g2/lib/transform/index.js:6:21)
    at Object. (/data/git/DB-GPT/web/node_modules/@antv/g2/lib/mark/interval.js:4:21)
    at Object. (/data/git/DB-GPT/web/node_modules/@antv/g2/lib/mark/index.js:4:18)
    at Object. (/data/git/DB-GPT/web/node_modules/@antv/g2/lib/lib/core.js:6:16)
    at Object. (/data/git/DB-GPT/web/node_modules/@antv/g2/lib/lib/index.js:4:14)
    at Object. (/data/git/DB-GPT/web/node_modules/@antv/g2/lib/index.js:18:15)
    at Object. (/data/git/DB-GPT/web/node_modules/@ant-design/plots/lib/index.js:30:23)
    at Object.2890 (/data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:79:18)
    at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
    at Object.6953 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:39088:20)
    at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
    at Object.66697 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:39785:27)
    at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
    at /data/git/DB-GPT/web/.next/server/chunks/2119.js:2662:71
    at Function.webpack_require.a (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:89:13)
    at Object.12186 (/data/git/DB-GPT/web/.next/server/chunks/2119.js:2656:21)
    at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
    at /data/git/DB-GPT/web/.next/server/chunks/8233.js:16:96
    at Function.webpack_require.a (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:89:13)
    at Object.68233 (/data/git/DB-GPT/web/.next/server/chunks/8233.js:9:21)
    at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
    at /data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:30:133
    at Function.webpack_require.a (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:89:13)
    at Object.88617 (/data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:11:21)
    at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
    at webpack_exec (/data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:3799:39)
    at /data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:3800:158
    at Function.webpack_require.X (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:177:21)
    at /data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:3800:47
    at Object. (/data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:3803:3)
    at requirePage (/data/git/DB-GPT/web/node_modules/next/dist/server/require.js:156:12)
    at /data/git/DB-GPT/web/node_modules/next/dist/server/load-components.js:68:84
    at async loadComponentsImpl (/data/git/DB-GPT/web/node_modules/next/dist/server/load-components.js:68:26)
    at async /data/git/DB-GPT/web/node_modules/next/dist/build/utils.js:1008:32
    at async Span.traceAsyncFn (/data/git/DB-GPT/web/node_modules/next/dist/trace/trace.js:103:20) {
    code: 'ERR_REQUIRE_ESM'
    }
    node:internal/process/promises:279
    triggerUncaughtException(err, true /* fromPromise */);
    ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /data/git/DB-GPT/web/node_modules/d3-array/src/index.js from /data/git/DB-GPT/web/node_modules/d3-geo/dist/d3-geo.js not supported.
Instead change the require of index.js in /data/git/DB-GPT/web/node_modules/d3-geo/dist/d3-geo.js to a dynamic import() which is available in all CommonJS modules.
at /data/git/DB-GPT/web/node_modules/d3-geo/dist/d3-geo.js:3:81
at Object. (/data/git/DB-GPT/web/node_modules/d3-geo/dist/d3-geo.js:6:2)
at Object.70312 (/data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:247:18)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.78278 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:5703:18)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.40509 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:6043:17)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.90288 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:17282:23)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.78841 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:23698:22)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.3876 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:22809:19)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.49160 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:21870:22)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.87978 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:23955:21)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.81308 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:25234:16)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.5000 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:22953:16)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.35244 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:16369:19)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.76814 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:12501:17)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.82636 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:13847:26)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.36349 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:17323:23)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.10288 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:17549:14)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.86300 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:10728:15)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.75174 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:39893:14)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.43127 (/data/git/DB-GPT/web/.next/server/chunks/4383.js:39951:15)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.83325 (/data/git/DB-GPT/web/.next/server/chunks/2119.js:25:11)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at Object.12179 (/data/git/DB-GPT/web/.next/server/chunks/2119.js:1008:17)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at /data/git/DB-GPT/web/.next/server/chunks/2119.js:1718:75
at Function.webpack_require.a (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:89:13)
at Object.32119 (/data/git/DB-GPT/web/.next/server/chunks/2119.js:1713:21)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at /data/git/DB-GPT/web/.next/server/chunks/2119.js:2661:94
at Function.webpack_require.a (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:89:13)
at Object.12186 (/data/git/DB-GPT/web/.next/server/chunks/2119.js:2656:21)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at /data/git/DB-GPT/web/.next/server/chunks/8233.js:16:96
at Function.webpack_require.a (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:89:13)
at Object.68233 (/data/git/DB-GPT/web/.next/server/chunks/8233.js:9:21)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at /data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:30:133
at Function.webpack_require.a (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:89:13)
at Object.88617 (/data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:11:21)
at webpack_require (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:25:42)
at webpack_exec (/data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:3799:39)
at /data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:3800:158
at Function.webpack_require.X (/data/git/DB-GPT/web/.next/server/webpack-runtime.js:177:21)
at /data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:3800:47
at Object. (/data/git/DB-GPT/web/.next/server/pages/construct/app/extra/components/auto-plan/DetailsCard.js:3803:3)
at requirePage (/data/git/DB-GPT/web/node_modules/next/dist/server/require.js:156:12)
at /data/git/DB-GPT/web/node_modules/next/dist/server/load-components.js:68:84
at async loadComponentsImpl (/data/git/DB-GPT/web/node_modules/next/dist/server/load-components.js:68:26)
at async /data/git/DB-GPT/web/node_modules/next/dist/build/utils.js:1008:32
at async Span.traceAsyncFn (/data/git/DB-GPT/web/node_modules/next/dist/trace/trace.js:103:20) {
code: 'ERR_REQUIRE_ESM'
}

Build error occurred
Error: Failed to collect page data for /construct/app/extra/components/auto-plan/DetailsCard
at /data/git/DB-GPT/web/node_modules/next/dist/build/utils.js:1161:15
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
type: 'Error'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

@hustcc
Copy link
Member

hustcc commented Sep 30, 2024

error of d3 in nextjs. d3/d3-array#218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants