JSONDecodeError. after running "bench update && bench build "

I have been exploring the deployment of ERPNext on raspberry pi 5 on ubuntu server. I have successfully completed setting up production server later thought of adding Custome fields to the doctype and switched to development option but could not switch back to the production despite trying the options that i could find on forum and documentation. final command that i remember that i have executed is bench update and bench build, Since that I am struck at “internal server error” and “json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)” in my console. @frappedev @support1

complete error log


Traceback (most recent call last):
  File "/home/gts/frappe-bench/apps/frappe/frappe/middlewares.py", line 16, in __call__
    return super().__call__(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/env/lib/python3.11/site-packages/werkzeug/middleware/shared_data.py", line 249, in __call__
    return self.app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/env/lib/python3.11/site-packages/werkzeug/middleware/shared_data.py", line 249, in __call__
    return self.app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/app.py", line 74, in application
    app(environ, start_response),
  File "/home/gts/frappe-bench/env/lib/python3.11/site-packages/werkzeug/wrappers/request.py", line 189, in application
    resp = f(*args[:-2] + (request,))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/app.py", line 128, in application
    response = handle_exception(e)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/app.py", line 390, in handle_exception
    response = get_response("message", http_status_code=http_status_code)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/website/serve.py", line 26, in get_response
    response = ErrorPage(exception=e).render()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/website/page_renderers/template_page.py", line 84, in render
    html = self.get_html()
           ^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/website/utils.py", line 523, in cache_html_decorator
    html = func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/website/page_renderers/template_page.py", line 92, in get_html
    self.init_context()
  File "/home/gts/frappe-bench/apps/frappe/frappe/website/page_renderers/error_page.py", line 14, in init_context
    super().init_context()
  File "/home/gts/frappe-bench/apps/frappe/frappe/website/page_renderers/base_template_page.py", line 15, in init_context
    self.context.update(get_website_settings())
                        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/website/doctype/website_settings/website_settings.py", line 263, in get_website_settings
    context.boot = get_boot_data()
                   ^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/website/utils.py", line 181, in get_boot_data
    "assets_json": get_assets_json(),
                   ^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/utils/__init__.py", line 975, in get_assets_json
    frappe.local.assets_json = frappe.cache.get_value(
                               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 100, in get_value
    val = generator()
          ^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/utils/__init__.py", line 966, in _get_assets
    assets = frappe.parse_json(frappe.read_file("assets/assets.json"))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/__init__.py", line 2385, in parse_json
    return parse_json(val)
           ^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/utils/__init__.py", line 823, in parse_json
    val = json.loads(val)
          ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

bench build most likely didn’t succeed hence asset.json doesn’t exist.

Try rerunning it, my hunch is RPI is not capable enough for running frappe/erpnext and building it.

Thanks for replying @ankush. I am running erpnext on high spec RPi-5.

after running build command i am getting the following error

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at write_assets_json (/home/gts/frappe-bench/apps/frappe/esbuild/esbuild.js:403:21)
    at async execute (/home/gts/frappe-bench/apps/frappe/esbuild/esbuild.js:126:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/gts/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/gts/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/gts/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gts/frappe-bench/apps/frappe/frappe/commands/utils.py", line 72, in build
    bundle(
  File "/home/gts/frappe-bench/apps/frappe/frappe/build.py", line 257, in bundle
    frappe.commands.popen(command, cwd=frappe_app_path, env=get_node_env(), raise_err=True)
  File "/home/gts/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 97, in popen
    raise subprocess.CalledProcessError(return_, command)
subprocess.CalledProcessError: Command 'yarn run production --apps frappe --run-build-command' returned non-zero exit status 1.
ERROR: bench build --app frappe
subprocess.CalledProcessError: Command 'bench build --app frappe' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.11/dist-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/local/lib/python3.11/dist-packages/bench/commands/make.py", line 181, in get_app
    get_app(
  File "/usr/local/lib/python3.11/dist-packages/bench/app.py", line 771, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/usr/local/lib/python3.11/dist-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/bench/app.py", line 254, in install
    install_app(
  File "/usr/local/lib/python3.11/dist-packages/bench/app.py", line 919, in install_app
    build_assets(bench_path=bench_path, app=app, using_cached=using_cached)
  File "/usr/local/lib/python3.11/dist-packages/bench/utils/bench.py", line 376, in build_assets
    exec_cmd(command, cwd=bench_path, env=env)
  File "/usr/local/lib/python3.11/dist-packages/bench/utils/__init__.py", line 169, in exec_cmd
    raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: bench build --app frappe

I believe it is trying to fetch the files that are not present. i have pulled different branch and tried building but same result.