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

G6 5.x版本在vue2中使用报错 #6136

Closed
LJR198 opened this issue Aug 6, 2024 · 3 comments
Closed

G6 5.x版本在vue2中使用报错 #6136

LJR198 opened this issue Aug 6, 2024 · 3 comments

Comments

@LJR198
Copy link

LJR198 commented Aug 6, 2024

Describe the bug / 问题描述

ERROR Failed to compile with 1 error 16:27:49

error in ./node_modules/ml-matrix/matrix.js

Syntax Error: D:\TestProject\g6vue2\node_modules\ml-matrix\matrix.js: Class private methods are not enabled. Please add @babel/plugin-transform-private-methods to your configuration.
2828 | * @param {number} nColumns
2829 | */

2830 | #initData(nRows, nColumns) {
| ^
2831 | this.data = [];
2832 |
2833 | if (Number.isInteger(nColumns) && nColumns >= 0) {
at transformFile.next ()
at run.next ()
at transform.next ()

ERROR in ./node_modules/ml-matrix/matrix.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: D:\TestProject\g6vue2\node_modules\ml-matrix\matrix.js: Class private methods are not enabled. Please add @babel/plugin-transform-private-methods to your configuration.
2828 | * @param {number} nColumns
2829 | */

2830 | #initData(nRows, nColumns) {
| ^
2831 | this.data = [];
2832 |
2833 | if (Number.isInteger(nColumns) && nColumns >= 0) {
at File.buildCodeFrameError (D:\TestProject\g6vue2\node_modules@babel\core\lib\transformation\file\file.js:195:12)
at NodePath.buildCodeFrameError (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\path\index.js:116:21)
at shouldTransform (D:\TestProject\g6vue2\node_modules@babel\helper-create-class-features-plugin\lib\features.js:130:29)
at PluginPass.Class (D:\TestProject\g6vue2\node_modules@babel\helper-create-class-features-plugin\lib\index.js:112:44)
at newFn (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\visitors.js:172:14)
at NodePath._call (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\path\context.js:49:20)
at NodePath.call (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\path\context.js:39:18)
at NodePath.visit (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\path\context.js:85:31)
at TraversalContext.visitQueue (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\context.js:89:16)
at TraversalContext.visitMultiple (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\context.js:61:17)
at TraversalContext.visit (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\context.js:110:19)
at traverseNode (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\traverse-node.js:22:17)
at NodePath.visit (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\path\context.js:91:52)
at TraversalContext.visitQueue (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\context.js:89:16)
at TraversalContext.visitSingle (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\context.js:65:19)
at TraversalContext.visit (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\context.js:112:19)
at traverseNode (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\traverse-node.js:22:17)
at traverse (D:\TestProject\g6vue2\node_modules@babel\traverse\lib\index.js:53:34)
at transformFile (D:\TestProject\g6vue2\node_modules@babel\core\lib\transformation\index.js:82:31)
at transformFile.next ()
at run (D:\TestProject\g6vue2\node_modules@babel\core\lib\transformation\index.js:24:12)
at run.next ()
at transform (D:\TestProject\g6vue2\node_modules@babel\core\lib\transform.js:22:33)
at transform.next ()
at step (D:\TestProject\g6vue2\node_modules\gensync\index.js:261:32)
at D:\TestProject\g6vue2\node_modules\gensync\index.js:273:13
at async.call.result.err.err (D:\TestProject\g6vue2\node_modules\gensync\index.js:223:11)
at D:\TestProject\g6vue2\node_modules\gensync\index.js:189:28
at D:\TestProject\g6vue2\node_modules@babel\core\lib\gensync-utils\async.js:67:7
at D:\TestProject\g6vue2\node_modules\gensync\index.js:113:33
at step (D:\TestProject\g6vue2\node_modules\gensync\index.js:287:14)
at D:\TestProject\g6vue2\node_modules\gensync\index.js:273:13
at async.call.result.err.err (D:\TestProject\g6vue2\node_modules\gensync\index.js:223:11)
@ ./node_modules/ml-matrix/matrix.mjs 1:0-38 2:30-51 3:19-29 4:37-65 5:30-51 6:19-29 7:39-69 8:18-27 9:31-53 10:22-35 11:41-73 12:32-55 13:36-63 14:33-57 15:38-67 16:29-49 17:35-61 18:29-49 19:35-61 20:22-35 21:22-35 22:18-27 23:31-53 24:19-29 25:42-75 26:31-53 27:31-53 28:31-53 29:27-45 30:26-43 31:15-36 31:39-60 31:63-76 32:27-45 33:23-37 34:34-59 35:29-49 36:21-33 37:20-31
@ ./node_modules/@antv/layout/lib/mds.js 3:0-75 118:12-24 118:25-37 126:18-44 127:22-35 129:11-23
@ ./node_modules/@antv/layout/lib/exports.js 12:0-22 12:0-22
@ ./node_modules/@antv/layout/lib/index.js 1:0-26 1:0-26
@ ./node_modules/@antv/g6/esm/layouts/index.js 2:0-232 2:0-232 2:0-232 2:0-232 2:0-232 2:0-232 2:0-232 2:0-232 2:0-232 2:0-232 2:0-232 2:0-232 2:0-232 2:0-232
@ ./node_modules/@antv/g6/esm/exports.js 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284 7:0-284
@ ./node_modules/@antv/g6/esm/index.js 2:0-26 2:0-26
@ ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/App.vue?vue&type=script&lang=js 1:0-26 28:22-30
@ ./src/App.vue?vue&type=script&lang=js 1:0-190 1:206-209 1:211-398 1:211-398
@ ./src/App.vue 2:0-54 3:0-49 3:0-49 10:2-8
@ ./src/main.js 2:0-28 5:17-20

Reproduction link / 重现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

Windows

Browser / 浏览器

Chrome

Additional context / 补充说明

Vue版本为^2.6.14

@Aarebecca
Copy link
Contributor

环境问题麻烦按照提示修复:

Class private methods are not enabled. Please add @babel/plugin-transform-private-methods to your configuration.

@qwe123123123q
Copy link

按照提示安装@babel/plugin-transform-private-methods并不能解决上述问题

@chenlikun-sy
Copy link

@qwe123123123q

这个问题怎么解决的 ,升级5.0也遇到了这个问题 网上给的@babel/plugin-transform-private-methods配置方法也没有解决问题,react+umi环境

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

4 participants