Forum Discussion
Cannot import multiple r-script sources in RHTML visual
- 6 years ago
Hello,
It is an issue in the template, we will fix it soon.
To fix it for you now, please, change NodeListOf by HTMLCollectionOf type. It should help.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
[email protected] - Anonymous6 years ago
Confirmed. Changing the following seems to fix the issue:
./src/visual.ts
148 let headList: NodeListOf = el.getElementsByTagName("head"); > let headList: HTMLCollectionOf = el.getElementsByTagName("head"); 160 let bodyList: NodeListOf = el.getElementsByTagName("body"); > let bodyList: HTMLCollectionOf = el.getElementsByTagName("body");
Hello,
It looks like you try to create new project with non-webpack version of tools and it is probably required to set this file in tsconfig.json ('files' section).
I tried to build by your instruction with the latest version of powerbi-visuals-tools and everything looks OK.
To install the latest version of tools please run in a console the following command:
npm install -g powerbi-visuals-tools@latest
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
[email protected]
Following the same set of instructions after installing the latest powerbi-visuals-tools package has two new errors during compilation.
Additionally, the same error occurs when simply running the following 3 steps:
> pbiviz new sampleRHTMLVisual -t rhtml > cd .\sampleRHTMLVisual\ > pbiviz package
> pbiviz package info Building visual... info Start preparing plugin template info Finish preparing plugin template Error parsing bundle asset "C:\Users\foobar\sampleRHTMLVisual\.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\foobar\sampleRHTMLVisual\webpack.statistics.prod.html
ERROR Failed to compile with 2 errors 3:21:44 PM
error in C:\Users\foobar\sampleRHTMLVisual\src\visual.ts
[tsl] ERROR in C:\Users\foobar\sampleRHTMLVisual\src\visual.ts(148,17) TS2741: Property 'forEach' is missing in type 'HTMLCollectionOf<HTMLHeadElement>' but required in type 'NodeListOf<HTMLHeadElement>'.
error in C:\Users\foobar\sampleRHTMLVisual\src\visual.ts
[tsl] ERROR in C:\Users\foobar\sampleRHTMLVisual\src\visual.ts(160,13) TS2741: Property 'forEach' is missing in type 'HTMLCollectionOf<HTMLBodyElement>' but required in type 'NodeListOf<HTMLBodyElement>'. error Package wasn't created. 2 errors found
- v-evelk6 years agoMicrosoft Employee
Hello,
It is an issue in the template, we will fix it soon.
To fix it for you now, please, change NodeListOf by HTMLCollectionOf type. It should help.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
[email protected]- Anonymous6 years agoNot applicable
Confirmed. Changing the following seems to fix the issue:
./src/visual.ts
148 let headList: NodeListOf = el.getElementsByTagName("head"); > let headList: HTMLCollectionOf = el.getElementsByTagName("head"); 160 let bodyList: NodeListOf = el.getElementsByTagName("body"); > let bodyList: HTMLCollectionOf = el.getElementsByTagName("body"); - Anonymous6 years agoNot applicable
When I try to do as robjensen does here
Anonymous wrote:Confirmed. Changing the following seems to fix the issue:
./src/visual.ts
148 let headList: NodeListOf = el.getElementsByTagName("head"); > let headList: HTMLCollectionOf = el.getElementsByTagName("head"); 160 let bodyList: NodeListOf = el.getElementsByTagName("body"); > let bodyList: HTMLCollectionOf = el.getElementsByTagName("body"); I get the following error:
C:\sampleRHTMLVisual>pbiviz package
info Building visual...
info Start preparing plugin template
info Finish preparing plugin template
Error parsing bundle asset "C:\sampleRHTMLVisual\.tmp\drop\visual.js": no such fileNo bundles were parsed. Analyzer will show only original module sizes from stats file.
Webpack Bundle Analyzer saved report to C:\sampleRHTMLVisual\webpack.statistics.prod.html
ERROR Failed to compile with 2 errors 12:11:45 PMerror in C:\sampleRHTMLVisual\src\visual.ts
[tsl] ERROR in C:\sampleRHTMLVisual\src\visual.ts(148,27)
TS2314: Generic type 'HTMLCollectionOf<T>' requires 1 type argument(s).error in C:\sampleRHTMLVisual\src\visual.ts
[tsl] ERROR in C:\sampleRHTMLVisual\src\visual.ts(160,23)
TS2314: Generic type 'HTMLCollectionOf<T>' requires 1 type argument(s).Any suggestions?
- v-evelk6 years agoMicrosoft Employee
Is it possible to share a link to your repo that I could analyze it?
You could send it to [email protected]
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
[email protected]