Setting up development environment of polymer frontend does not work

I*ve set up both backend and frontend development environment according to the documentation.

When I execute

nvm use && script/develop in the home-assistant-polymer directory, it gets stuck:

 92% [0] after chunk asset optimization SourceMapDevToolPlugin voice-command-dia[0] Hash: 2965e4ad0f881d6d3b38                                
Version: webpack 4.12.0
Child
    Hash: 2965e4ad0f881d6d3b38
    Time: 23025ms
    Built at: 2018-08-23 14:40:43
                                                                                                                     Asset        Size                                                                                                         Chunks             Chunk Names
                                                                                                    images/config_wink.png    4.61 KiB                                                                                                                 [emitted]  

[…]

        [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 500 bytes {0} [built]
            + 1 hidden module
    Child html-webpack-plugin for "index.html":
         1 asset
        [./node_modules/html-webpack-plugin/lib/loader.js!./src/html/index.html.template] 3.69 KiB {0} [built]
        [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 487 bytes {0} [built]
        [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 500 bytes {0} [built]
            + 1 hidden module
    Child html-webpack-plugin for "onboarding.html":
         1 asset
        [./node_modules/html-webpack-plugin/lib/loader.js!./src/html/extra_page.html.template] 1.75 KiB {0} [built]
        [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 487 bytes {0} [built]
        [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 500 bytes {0} [built]
            + 1 hidden module

(after some minutes of nothing happened, I pressed CTRL+C)

Then, when I start home assistant with hass --skip-pip from the backend’s main directory and then try to acces localhost:8123 with my browser, I get a HTTP 500.

Stacktrace in hass:

2018-08-23 14:33:21 INFO (MainThread) [homeassistant.components.http.view] Serving / to 127.0.0.1 (auth: True)
2018-08-23 14:33:21 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/home/user/home-assistant/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 378, in start
    resp = await self._request_handler(request)
  File "/home/user/home-assistant/lib/python3.6/site-packages/aiohttp/web_app.py", line 341, in _handle
    resp = await handler(request)
  File "/home/user/home-assistant/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 88, in impl
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/static.py", line 66, in staticresource_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/ban.py", line 67, in ban_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/auth.py", line 66, in auth_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/ban.py", line 67, in ban_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/auth.py", line 66, in auth_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/view.py", line 113, in handle
    result = await result
  File "/home/user/home-assistant/homeassistant/components/frontend/__init__.py", line 428, in get
    template = await hass.async_add_job(self.get_template, latest)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/user/home-assistant/homeassistant/components/frontend/__init__.py", line 396, in get_template
    with open(os.path.join(root, 'index.html')) as file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/home-assistant-polymer/hass_frontend_es5/index.html'
2018-08-23 14:33:21 INFO (MainThread) [homeassistant.components.http.view] Serving / to 127.0.0.1 (auth: True)
2018-08-23 14:33:21 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/home/user/home-assistant/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 378, in start
    resp = await self._request_handler(request)
  File "/home/user/home-assistant/lib/python3.6/site-packages/aiohttp/web_app.py", line 341, in _handle
    resp = await handler(request)
  File "/home/user/home-assistant/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 88, in impl
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/static.py", line 66, in staticresource_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/ban.py", line 67, in ban_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/auth.py", line 66, in auth_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/ban.py", line 67, in ban_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/auth.py", line 66, in auth_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/view.py", line 113, in handle
    result = await result
  File "/home/user/home-assistant/homeassistant/components/frontend/__init__.py", line 428, in get
    template = await hass.async_add_job(self.get_template, latest)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/user/home-assistant/homeassistant/components/frontend/__init__.py", line 396, in get_template
    with open(os.path.join(root, 'index.html')) as file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/home-assistant-polymer/hass_frontend_es5/index.html'
2018-08-23 14:33:22 INFO (MainThread) [homeassistant.components.http.view] Serving / to 127.0.0.1 (auth: True)
2018-08-23 14:33:22 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/home/user/home-assistant/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 378, in start
    resp = await self._request_handler(request)
  File "/home/user/home-assistant/lib/python3.6/site-packages/aiohttp/web_app.py", line 341, in _handle
    resp = await handler(request)
  File "/home/user/home-assistant/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 88, in impl
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/static.py", line 66, in staticresource_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/ban.py", line 67, in ban_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/auth.py", line 66, in auth_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/ban.py", line 67, in ban_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/auth.py", line 66, in auth_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/view.py", line 113, in handle
    result = await result
  File "/home/user/home-assistant/homeassistant/components/frontend/__init__.py", line 428, in get
    template = await hass.async_add_job(self.get_template, latest)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/user/home-assistant/homeassistant/components/frontend/__init__.py", line 396, in get_template
    with open(os.path.join(root, 'index.html')) as file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/home-assistant-polymer/hass_frontend_es5/index.html'
2018-08-23 14:33:22 INFO (MainThread) [homeassistant.components.http.view] Serving / to 127.0.0.1 (auth: True)
2018-08-23 14:33:22 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/home/user/home-assistant/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 378, in start
    resp = await self._request_handler(request)
  File "/home/user/home-assistant/lib/python3.6/site-packages/aiohttp/web_app.py", line 341, in _handle
    resp = await handler(request)
  File "/home/user/home-assistant/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 88, in impl
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/static.py", line 66, in staticresource_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/ban.py", line 67, in ban_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/auth.py", line 66, in auth_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/ban.py", line 67, in ban_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/auth.py", line 66, in auth_middleware
    return await handler(request)
  File "/home/user/home-assistant/homeassistant/components/http/view.py", line 113, in handle
    result = await result
  File "/home/user/home-assistant/homeassistant/components/frontend/__init__.py", line 428, in get
    template = await hass.async_add_job(self.get_template, latest)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/user/home-assistant/homeassistant/components/frontend/__init__.py", line 396, in get_template
    with open(os.path.join(root, 'index.html')) as file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/home-assistant-polymer/hass_frontend_es5/index.html'
2018-08-23 14:33:30 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sun.sun, old_state=<state sun.sun=above_horizon; next_dawn=2018-08-24T05:38:02+00:00, next_dusk=2018-08-23T18:27:16+00:00, next_midnight=2018-08-24T00:02:22+00:00, next_noon=2018-08-24T12:02:30+00:00, next_rising=2018-08-24T05:59:07+00:00, next_setting=2018-08-23T18:06:10+00:00, elevation=76.53, azimuth=326.26, friendly_name=Sun @ 2018-08-23T12:32:50.045335+00:00>, new_state=<state sun.sun=above_horizon; next_dawn=2018-08-24T05:38:02+00:00, next_dusk=2018-08-23T18:27:16+00:00, next_midnight=2018-08-24T00:02:22+00:00, next_noon=2018-08-24T12:02:30+00:00, next_rising=2018-08-24T05:59:07+00:00, next_setting=2018-08-23T18:06:10+00:00, elevation=76.44, azimuth=325.68, friendly_name=Sun @ 2018-08-23T12:32:50.045335+00:00>>

What could be wrong here?

2 Likes

For me I download the frontend source code
after run, script/develop, it gets stuck too.

Entrypoint undefined = onboarding.html
        [./node_modules/html-webpack-plugin/lib/loader.js!./src/html/onboarding.html.template] 2.13 KiB {0} [built]
        [./node_modules/raw-loader/index.js!./src/html/_header.html.template] ./node_modules/raw-loader!./src/html/_header.html.template 476 bytes {0} [built]
        [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 475 bytes {0} [built]
        [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 546 bytes {0} [built]
            + 1 hidden module

I built frontend on windows 10 with ubuntu, and got stuck.
I tried on ubuntu on vmware, and it is working fine in case of only frontend.
I do not try server.

Do you have any progress on server?

I get the same behavior, but after Ctrl-c and starting up Hass pointing to the development frontend repo, it works. This was on a previous version 87.x, however when I tried.

I hit the same “hang” after onboarding, but it appears to be caused by the “–watch” flag to webpack and I think it’s designed to sit there and watch for any changes so that it can rebuild. If you omit the “–watch” flag (“node ./node_modules/.bin/webpack --progress”), script/develop completes successfully.