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 npm@5.6.0
3 info using node@v8.9.4
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle standin@1.0.0~prebuild: standin@1.0.0
6 info lifecycle standin@1.0.0~build: standin@1.0.0
7 verbose lifecycle standin@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle standin@1.0.0~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 standin@1.0.0~build: CWD: C:\Program Files\Splunk\share\splunk\app_templates\viz_tutorial_app\appserver\static\visualizations\radial_meter
10 silly lifecycle standin@1.0.0~build: Args: [ '/d /s /c',
10 silly lifecycle '$SPLUNK_HOME/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js' ]
11 silly lifecycle standin@1.0.0~build: Returned: code: 1 signal: null
12 info lifecycle standin@1.0.0~build: Failed to exec build script
13 verbose stack Error: standin@1.0.0 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 standin@1.0.0
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 standin@1.0.0 build: $SPLUNK_HOME/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js
22 error Exit status 1
23 error Failed at the standin@1.0.0 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! standin@1.0.0 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 standin@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...