[英]Power BI custom D3 chart Could not find plugin "proposal-numeric-separator"
我尝试过自定义 D3 Power BI,但显示以下错误。我也重新安装了 pbiviz 和节点,但显示相同的错误。需要一点帮助。
我尝试添加不同的旧版本但没有成功。 我的节点版本是 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://docs.microsoft.com/en-us/power-bi/power-bi-custom-visuals-certified#certification-requirements
经过长时间的反复试验,我整理出来了。
以下是步骤。 首先,手动安装有问题的依赖项:
npm install --save-dev @babel/core
npm install --save-dev @babel/preset-env
npm i @babel/plugin-proposal-numeric-separator
其次,转到发生错误的文件路径(不在您的代码目录中)。 就我而言:
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()
的路径参数替换为上面步骤 1 中@babel/plugin-proposal-numeric-separator
位置的绝对路径。
享受!
根本问题似乎是powerbi-visuals-tools
所依赖的@babel/plugin-proposal-numeric-separator
有问题的版本。
已接受解决方案的替代方案是安装@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.js
var _pluginTransformNumericSeperator = _interopRequireDefault(require("@babel/plugin-proposal-numeric-separator"));
_default
定义之上的任何位置"proposal-numeric-separator": _pluginTransformNumericSeperator
_default
添加依赖项作为新导出您现在应该看到构建成功。
请注意,我通常会避免安装这样的全局依赖项。 但是,在更新powerbi-visuals-tools
包以解决此问题之前,这可能是最简单的解决方法。 完成后,我建议卸载全局依赖项并从头开始重新安装powerbi-visuals-tools
以撤消我们对依赖项文件的更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.