Getting Data In

Error when using npm run build for Custom Visualization Tutorial

nw
Loves-to-Learn

Hello,

I was going through the Custom Visualization Tutorial here: 
https://docs.splunk.com/Documentation/Splunk/9.1.1/AdvancedDev/CustomVizTutorial

When I got to the step to build the visualization, I ran into the following error when trying to build using windows using npm run build which is also described in this forum post by @niketn :
https://community.splunk.com/t5/Getting-Data-In/Why-does-Splunk-Custom-Visualization-API-result-in-a...

> $SPLUNK_HOME/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js

'$SPLUNK_HOME' is not recognized as an internal or external command,
operable program or batch file.

The workaround described in the post is to change the SPLUNK_HOME Windows Environment variable in the package.json file from the *NIX format ($SPLUNK_HOME)  to  the Windows (%SPLUNK_HOME%) so that the scripts look like below.

  "scripts": {
    "build": "%SPLUNK_HOME%/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js",
    "devbuild": "%SPLUNK_HOME%/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js --progress",
    "watch": "%SPLUNK_HOME%/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js -d --watch --progress"
  }

However, when I attempt to build the visualization after changing the package.json file, I still get the following error: 

> [email protected] devbuild
> %SPLUNK_HOME%/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js --progress

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

I am assuming this is because the file path is "C:\Program Files\Splunk" which contains a space. According to the original forum post, the only way to build the visualization on Windows is to reinstall Splunk in a different file path that does not contain spaces. I was hoping there is a different solution for Windows that does not require the reinstallation of Splunk? Or if there is any other mistake I am making that would cause the build to fail?

Thanks!

Labels (1)
0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@nw - Yes, I have seen the issue. "Program Files" has space in the path.  That's the issue. I would switched to Linux or Mac instead. Somehow Windows doesn't work well with it.

Alternatively for Windows, I could say that you can install Splunk on Windows in any folder, and install it in a folder that doesn't have space in the path.

 

I hope this helps!!!

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Make Your Machine Data AI-Ready in Splunk

Every team is getting ready for AI agents.   Thursday, November 12, 2026  |  11AM  PST / 2PM EST   ...

Splunk Asynchronous Forwarding Explained

Splunk asynchronous forwarding is often misunderstood as simply setting autoLBVolume. That is not quite right. ...

How to Monitor AI Agents with Splunk Agent Observability

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...