我尝试过定制D3 Power BI,但是下面显示的错误.I也重新安装了pbiviz和节点,但是显示了相同的错误.Need几乎没有帮助。
我试着添加不同版本的老版本,但没有成功。我的节点版本是v12.16.1。和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://learn.microsoft.com/en-us/power-bi/power-bi-custom-visuals-certified#certification-requirements
发布于 2020-03-21 21:41:06
经过长时间的尝试和错误,我把它整理好了。
这是台阶。首先,手动安装有问题的依赖项:
npm install --save-dev @babel/core
npm install --save-dev @babel/preset-env
npm i @babel/plugin-proposal-numeric-separator其次,转到发生错误的文件路径(不是在代码dir中)。就我而言:
C:/Users/mahendra/AppData/Roaming/npm/node_modules/powerbi-visuals-tools/node_modules/@babel/preset-env/lib/available-plugins.js请注意,这是通过检查错误消息并注意到这一行发现的:
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")
最后,将以下行添加到文件中:
var _pluginTransformNumericSeperator = _interopRequireDefault(require("@babel/plugin-proposal-numeric-separator")); (导入依赖项;在导出对象_default)"proposal-numeric-separator": _pluginTransformNumericSeperator (通过添加新的键值对在导出对象_default中将依赖项添加为新导出)的定义之上的任何地方)请注意,如果您在下一次构建中无法解决此问题,则可能必须将require()的path参数替换为上面步骤1中指向@babel/plugin-proposal-numeric-separator位置的绝对路径。
享受吧!
发布于 2020-03-25 15:26:35
根本的问题似乎是@babel/plugin-proposal-numeric-separator的一个有问题的版本,powerbi-visuals-tools所依赖的。
接受的解决方案的一个替代方法是将@babel/plugin-proposal-numeric-separator的工作版本安装为全局依赖项,然后修改powerbi-visuals-tools以使用此版本而不是打包版本。见以下步骤:
npm i -g @babel/plugin-proposal-numeric-separator<userDir>/AppData/Roaming/npm/node_modules/powerbi-visuals-tools/node_modules/@babel/preset-env/lib/available-plugins.jsvar _pluginTransformNumericSeperator = _interopRequireDefault(require("@babel/plugin-proposal-numeric-separator")); _default定义之上的任何位置
1. `"proposal-numeric-separator": _pluginTransformNumericSeperator`
- Add the dependency as a new export in the export object `_default` by adding a new key value pair
现在,您应该看到构建成功了。
请注意,我通常会避免像这样安装全局依赖项。但是,在更新powerbi-visuals-tools包以解决此问题之前,这可能是最简单的解决方法。完成此操作后,我建议卸载全局依赖项并从头重新安装powerbi-visuals-tools以撤消对依赖文件的更改。
https://stackoverflow.com/questions/60791008
复制相似问题