Splunk Dev

getting error on npm run build error on visualization

spammenot66
Contributor

I'm trying to create

I'm following all steps from the custom visualization tutorial. After i enter " npm run build"  on the /opt/splunk/etc/apps/testchart/appserver/static/visualization/testchart folder, it throws the error

ERROR in ./~/xmlhttprequest/lib/XMLHttpRequest.js
Module not found: Error: Cannot resolve module 'child_process' in /opt/splunk/etc/apps/testchart/appserver/static/visualizations/testchart/node_modules/xmlhttprequest/lib
@ ./~/xmlhttprequest/lib/XMLHttpRequest.js 15:12-36

ERROR in ./~/xmlhttprequest/lib/XMLHttpRequest.js

 

any input would be greatly appreciated.
Module not found: Error: Cannot resolve module 'fs' in /opt/splunk/etc/apps/testchart/appserver/static/visualizations/testchart/node_modules/xmlhttprequest/lib
@ ./~/xmlhttprequest/lib/XMLHttpRequest.js 16:9-22

Is this due to code that i've copied incorrectly or something else?

Labels (1)
0 Karma
1 Solution

spammenot66
Contributor

this seems to resolve my issue. 

The true solution to this seems to be to add target: 'node' to your module.exports object in webpack.config.js. At least, that was the solution for me.


 

View solution in original post

0 Karma

spammenot66
Contributor

this seems to resolve my issue. 

The true solution to this seems to be to add target: 'node' to your module.exports object in webpack.config.js. At least, that was the solution for me.


 
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...