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: 

> standin@1.0.0 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
Get Updates on the Splunk Community!

Database Performance Sidebar Panel Now on APM Database Query Performance & Service ...

We’ve streamlined the troubleshooting experience for database-related service issues by adding a database ...

IM Landing Page Filter - Now Available

We’ve added the capability for you to filter across the summary details on the main Infrastructure Monitoring ...

Dynamic Links from Alerts to IM Navigators - New in Observability Cloud

Splunk continues to improve the troubleshooting experience in Observability Cloud with this latest enhancement ...