Problems building the frontend: script/build_frontend

I’m in a similar boat to Front-end development help which identify the package.json instructions as confusing - I’d agree.

I’m at the point where I’ve successfully updated a few backend features but can’t get the front-end to build. Running script/build_frontend results in:

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   'prod' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preprod', 'prod', 'postprod' ]
5 info preprod [email protected]
6 info prod [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec prod script
9 verbose stack Error: [email protected] prod: `BUILD_DEV=0 rollup -c rollup.config.js --output dist/homeassistant.es6.js`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:217:16)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at EventEmitter.emit (events.js:172:7)
9 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at ChildProcess.emit (events.js:172:7)
9 verbose stack     at maybeClose (internal/child_process.js:827:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid [email protected]
11 verbose cwd C:\Users\Garrett\Documents\home-assistant\homeassistant\components\frontend\www_static\home-assistant-polymer\home-assistant-js
12 error Windows_NT 6.1.7601
13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "prod"
14 error node v4.4.5
15 error npm  v2.15.5
16 error code ELIFECYCLE
17 error [email protected] prod: 'BUILD_DEV=0 rollup -c rollup.config.js --output dist/homeassistant.es6.js'
17 error Exit status 1
18 error Failed at the [email protected] prod script 'BUILD_DEV=0 rollup -c rollup.config.js --output dist/homeassistant.es6.js'.
18 error This is most likely a problem with the home-assistant-js package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     BUILD_DEV=0 rollup -c rollup.config.js --output dist/homeassistant.es6.js
18 error You can get information on how to open an issue for this project with:
18 error     npm bugs home-assistant-js
18 error Or if that isn't available, you can get their info via:
18 error
18 error     npm owner ls home-assistant-js
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

On a fresh Windows 7, newly cloned HA repos, node 4.4.5, npm 2.15.5, python 3.5.1

1 Like

Solved it, issue with build commands in the package.json for both home-assistant-polymer, and home-assistant-js. The variable setting needs the “set” keyword in Windows - or at least my Windows environment.

I’ll either try to submit a PR for both repos, or just create an Issue if I can’t figure it out.

In the words of Nick Burns “YOU’RE WELCOME”.

I had similar problems and had to add some “set” words to package.json

After that I was able to run my frontend build, but I some panels would not show up.
By doing some debugging and going through the code I was able pinpoint the cause. The fingerprints
generated by the python script “fingerprint_frontend.py” were added to the dictionary with windows
relative path like keys (instead of linux like path), so all the panels in the “panels” folder had
paths like “panels\ha-panel-config.html”.
And in some part of the code tries to find panels with key like “panels/ha-panel-config.html”,
for that reason most of the panels would not load up.

After adding line:

name = name.replace('\\', '/') # for windows

to “fingerprint_frontend.py” after the line 23, the panels did show up and most of the functionality seems to work

Not sure if I’m building the frontend right way, but thought I mention my findings anyway. Wondering if anyone else has had same problem.