简体   繁体   English

Power BI 自定义 D3 图表找不到插件“提案数字分隔符”

[英]Power BI custom D3 chart Could not find plugin "proposal-numeric-separator"

I have tried for custom D3 Power BI ,but showing me below error .I also reinstall pbiviz and node but showing same error .Need little help.我尝试过自定义 D3 Power BI,但显示以下错误。我也重新安装了 pbiviz 和节点,但显示相同的错误。需要一点帮助。

I tried adding different version older but not got success.我尝试添加不同的旧版本但没有成功。 my node version is v12.16.1.我的节点版本是 v12.16.1。 and pbiviz 3.1.10 Now和 pbiviz 3.1.10 现在

 PS C:\\Users\\mahendra\\Downloads\\PowerBI-visuals-sampleBarChart-master\\PowerBI-visuals-sampleBarChart-master\\CircleCard> pbiviz package info Building visual... info Start preparing plugin template info Finish preparing plugin template Error parsing bundle asset "C:\\Users\\mahendra\\Downloads\\PowerBI-visuals-sampleBarChart-master\\PowerBI-visuals-sampleBarChart-master\\CircleCard\\.tmp\\drop\\visual.js": no such file No bundles were parsed. Analyzer will show only original module sizes from stats file. Webpack Bundle Analyzer saved report to C:\\Users\\mahendra\\Downloads\\PowerBI-visuals-sampleBarChart-master\\PowerBI-visuals-sampleBarChart-master\\CircleCard\\webpack.statistics.prod.html ERROR Failed to compile with 1 errors 10:43:12 PM error in ./.tmp/precompile/visualPlugin.ts Module build failed (from C:/Users/mahendra/AppData/Roaming/npm/node_modules/powerbi-visuals-tools/node_modules/babel-loader/lib/index.js): Error: [BABEL] C:\\Users\\mahendra\\Downloads\\PowerBI-visuals-sampleBarChart-master\\PowerBI-visuals-sampleBarChart-master\\CircleCard\\.tmp\\precompile\\visualPlugin.ts: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "C:\\\\Users\\\\mahendra\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\powerbi-visuals-tools\\\\node_modules\\\\@babel\\\\preset-env\\\\lib\\\\index.js") at getPlugin (C:\\Users\\mahendra\\AppData\\Roaming\\npm\\node_modules\\powerbi-visuals-tools\\node_modules\\@babel\\preset-env\\lib\\index.js:67:11) at C:\\Users\\mahendra\\AppData\\Roaming\\npm\\node_modules\\powerbi-visuals-tools\\node_modules\\@babel\\preset-env\\lib\\index.js:258:62 at Array.map (<anonymous>) at C:\\Users\\mahendra\\AppData\\Roaming\\npm\\node_modules\\powerbi-visuals-tools\\node_modules\\@babel\\preset-env\\lib\\index.js:258:43 at C:\\Users\\mahendra\\AppData\\Roaming\\npm\\node_modules\\powerbi-visuals-tools\\node_modules\\@babel\\helper-plugin-utils\\lib\\index.js:19:12 at C:\\Users\\mahendra\\AppData\\Roaming\\npm\\node_modules\\powerbi-visuals-tools\\node_modules\\@babel\\core\\lib\\config\\full.js:199:14 at Generator.next (<anonymous>) at Function.<anonymous> (C:\\Users\\mahendra\\AppData\\Roaming\\npm\\node_modules\\powerbi-visuals-tools\\node_modules\\@babel\\core\\lib\\gensync-utils\\async.js:26:3) at Generator.next (<anonymous>) at step (C:\\Users\\mahendra\\AppData\\Roaming\\npm\\node_modules\\powerbi-visuals-tools\\node_modules\\gensync\\index.js:254:32) at evaluateAsync (C:\\Users\\mahendra\\AppData\\Roaming\\npm\\node_modules\\powerbi-visuals-tools\\node_modules\\gensync\\index.js:284:5) at Function.errback (C:\\Users\\mahendra\\AppData\\Roaming\\npm\\node_modules\\powerbi-visuals-tools\\node_modules\\gensync\\index.js:108:7) at errback (C:\\Users\\mahendra\\AppData\\Roaming\\npm\\node_modules\\powerbi-visuals-tools\\node_modules\\@babel\\core\\lib\\gensync-utils\\async.js:70:18) at async (C:\\Users\\mahendra\\AppData\\Roaming\\npm\\node_modules\\powerbi-visuals-tools\\node_modules\\gensync\\index.js:183:31) at onFirstPause (C:\\Users\\mahendra\\AppData\\Roaming\\npm\\node_modules\\powerbi-visuals-tools\\node_modules\\gensync\\index.js:209:13) at Generator.next (<anonymous>) @ multi ./.tmp/precompile/visualPlugin.ts error Package wasn't created. 1 errors found warn Please, make sure that the visual source code matches to requirements of certification: info Visual must use API v2.5 and above info The project repository must: info Include package.json and package-lock.json; info Not include node_modules folder info Run npm install expect no errors info Run pbiviz package expect no errors info The compiled package of the Custom Visual should match submitted package. info npm audit command must not return any alerts with high or moderate level. info The project must include Tslint from Microsoft with no overridden configuration, and this command shouldn't return any tslint errors. info https://www.npmjs.com/package/tslint-microsoft-contrib info Ensure no arbitrary/dynamic code is run (bad: eval(), unsafe use of settimeout(), requestAnimationFrame(), setinterval(some function with user input).. running user input/data etc.) info Ensure DOM is manipulated safely (bad: innerHTML, D3.html(<some user/data input>), unsanitized user input/data directly added to DOM, etc.) info Ensure no js errors/exceptions in browser console for any input data. As test dataset please use this sample report info Full description of certification requirements you can find in documentation: info https://docs.microsoft.com/en-us/power-bi/power-bi-custom-visuals-certified#certification-requirements

I sorted out after long trial and error.经过长时间的反复试验,我整理出来了。

Here are the steps.以下是步骤。 First, manually install the problematic dependencies:首先,手动安装有问题的依赖项:

npm install --save-dev @babel/core
npm install --save-dev @babel/preset-env
npm i @babel/plugin-proposal-numeric-separator

Second, go to file path in which the error is occurring (not in your code dir).其次,转到发生错误的文件路径(不在您的代码目录中)。 In my case:就我而言:

C:/Users/mahendra/AppData/Roaming/npm/node_modules/powerbi-visuals-tools/node_modules/@babel/preset-env/lib/available-plugins.js

Note that this was found by examining the error message and noticing this line:请注意,这是通过检查错误消息并注意以下行发现的:

Ensure there is an entry in ./available-plugins.js for it. (While processing: "C:/Users/mahendra/AppData/Roaming/npm/node_modules/powerbi-visuals-tools/node_modules/@babel/preset-env/lib/index.js")

Finally, add the following lines to the file:最后,将以下行添加到文件中:

  1. var _pluginTransformNumericSeperator = _interopRequireDefault(require("@babel/plugin-proposal-numeric-separator")); (Import dependency; anywhere above the definition of the export object _default ) (导入依赖;在导出对象_default定义之上的任何位置)

  2. "proposal-numeric-separator": _pluginTransformNumericSeperator (Add the dependency as a new export in the export object _default by adding a new key value pair) "proposal-numeric-separator": _pluginTransformNumericSeperator (通过添加新的键值对在导出对象_default添加依赖项作为新导出)

Note that you may have to replace the path argument to require() with an absolute path to the location of @babel/plugin-proposal-numeric-separator in step 1 above if you are unable to resolve this during your next build.请注意,如果您在下一次构建期间无法解决此问题,则可能需要将require()的路径参数替换为上面步骤 1 中@babel/plugin-proposal-numeric-separator位置的绝对路径。

Enjoy!享受!

The root issue seems to be a problematic version of @babel/plugin-proposal-numeric-separator that powerbi-visuals-tools is depending on.根本问题似乎是powerbi-visuals-tools所依赖的@babel/plugin-proposal-numeric-separator有问题的版本。

An alternative to the accepted solution is to install a working version of @babel/plugin-proposal-numeric-separator as a global dependency and then modify the powerbi-visuals-tools to use this instead of its packaged version.已接受解决方案的替代方案是安装@babel/plugin-proposal-numeric-separator的工作版本作为全局依赖项,然后修改powerbi-visuals-tools以使用它而不是其打包版本。 See steps below:请参阅以下步骤:

  1. npm i -g @babel/plugin-proposal-numeric-separator
  2. Locate the file that lists dependencies for the failing module.找到列出故障模块的依赖项的文件。 See the accepted answer for instructions, but it seems to be this path for Windows: <userDir>/AppData/Roaming/npm/node_modules/powerbi-visuals-tools/node_modules/@babel/preset-env/lib/available-plugins.js有关说明,请参阅已接受的答案,但对于 Windows,它似乎是此路径: <userDir>/AppData/Roaming/npm/node_modules/powerbi-visuals-tools/node_modules/@babel/preset-env/lib/available-plugins.js
  3. Add the following lines to this file:将以下行添加到此文件中:
    1. var _pluginTransformNumericSeperator = _interopRequireDefault(require("@babel/plugin-proposal-numeric-separator"));
      • This imports our globally installed dependency: place anywhere above the definition of the export object _default这将导入我们全局安装的依赖项:放置在导出对象_default定义之上的任何位置
    2. "proposal-numeric-separator": _pluginTransformNumericSeperator
      • Add the dependency as a new export in the export object _default by adding a new key value pair通过添加新的键值对在导出对象_default添加依赖项作为新导出

You should now see the build succeed.您现在应该看到构建成功。

As a note, I'd generally avoid installing global dependencies like this.请注意,我通常会避免安装这样的全局依赖项。 However, this may be the easiest workaround until the powerbi-visuals-tools package is updated to fix this issue.但是,在更新powerbi-visuals-tools包以解决此问题之前,这可能是最简单的解决方法。 When this is done, I would recommend uninstalling the global dependency and reinstalling the powerbi-visuals-tools from scratch to undo our changes to the dependency file.完成后,我建议卸载全局依赖项并从头开始重新安装powerbi-visuals-tools以撤消我们对依赖项文件的更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM