All Apps and Add-ons

npm run build

bizsplunk
Engager

hi team, can somebody help with npm run build issue ? also, i declared splunk_home varialble and this result is after.
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Program Files\Splunk\share\splunk\app_templates\viz_tutorial_app\appserver\static\visualizations\radial_meter\node_modules.bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\nodejs\;C:\Program Files\PuTTY\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\i.sysa\AppData\Local\Programs\Python\Python37;C:\Users\i.sysa\AppData\Local\Programs\Python\Python37\Scripts;C:\Users\i.sysa\AppData\Local\Microsoft\WindowsApps;C:\Users\i.sysa\AppData\Roaming\npm
9 verbose lifecycle [email protected]~build: CWD: C:\Program Files\Splunk\share\splunk\app_templates\viz_tutorial_app\appserver\static\visualizations\radial_meter
10 silly lifecycle [email protected]~build: Args: [ '/d /s /c',
10 silly lifecycle '$SPLUNK_HOME/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js' ]
11 silly lifecycle [email protected]~build: Returned: code: 1 signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: $SPLUNK_HOME/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Program Files\Splunk\share\splunk\app_templates\viz_tutorial_app\appserver\static\visualizations\radial_meter
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build"
18 verbose node v8.9.4
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: $SPLUNK_HOME/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

0 Karma
1 Solution

poete
Builder

Hello @bizsplunk,

as you are running npm on windows, please check if the package.json file, the $SPLUNK_HOME is replaced by %SPLUNK_HOME%

View solution in original post

0 Karma

poete
Builder

Hello @bizsplunk,

as you are running npm on windows, please check if the package.json file, the $SPLUNK_HOME is replaced by %SPLUNK_HOME%

0 Karma

bizsplunk
Engager

Hi @poete, how to check it ?

0 Karma

poete
Builder

@bizsplunk,
locate the package.json file at the root of your viz directory, and open it with a test editor.

Then, you should finf lines like :

"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"
  },
0 Karma

bizsplunk
Engager

i repalced and now it says that :
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
i used this command for my splunk_home variable:
setx $SPLUNK_HOME "C:\Program Files\Splunk"

0 Karma

poete
Builder

@bizsplunk,
most probably, the environment variable breaks one the space between Program and Files. Can you try to set SPLUNK_HOME with double quotes and run npm again?

0 Karma

bizsplunk
Engager

already done it - setx $SPLUNK_HOME "C:\Program Files\Splunk"
same error 😞

0 Karma

poete
Builder

@bizsplunk,

do the same without the $

0 Karma

bizsplunk
Engager

@poete ,
same error

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1

0 Karma

poete
Builder

@bizsplunk,
what is the result of echo %SPLUNK_HOME%?

0 Karma

bizsplunk
Engager

@poete,
result is :
C:\Program Files\Splunk

0 Karma

bizsplunk
Engager

i replaced and then run "npm run build" command and now it says that
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:
%$SPLUNK_HOME%/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

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!

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...