# Buggy code
def _run_nodejs(script, input):
    if _nodejs is None:
        raise RuntimeError(
            "node.js is needed to allow compilation of custom models "
            + '("conda install -c bokeh nodejs" or follow https://nodejs.org/en/download/)'
        )

    proc = Popen([_nodejs, script], stdout=PIPE, stderr=PIPE, stdin=PIPE)
    (stdout, errout) = proc.communicate(input=json.dumps(input).encode())

    if len(errout) > 0:
        raise RuntimeError(errout)
    else:
        return AttrDict(json.loads(stdout.decode()))


# Traceback (RuntimeError)
[bryan:...xamples/custom/font-awesome]$ BOKEH_RESOURCES=inline python font-awesome.py                                   (bryanv/5626_properties_py)
Traceback (most recent call last):
File "font-awesome.py", line 10, in <module>
show(column(btn))
File "/Users/bryan/work/bokeh/bokeh/io.py", line 300, in show
return _show_with_state(obj, _state, browser, new, notebook_handle=notebook_handle)
File "/Users/bryan/work/bokeh/bokeh/io.py", line 318, in _show_with_state
_show_file_with_state(obj, state, new, controller)
File "/Users/bryan/work/bokeh/bokeh/io.py", line 323, in _show_file_with_state
filename = save(obj, state=state)
File "/Users/bryan/work/bokeh/bokeh/io.py", line 382, in save
_save_helper(obj, filename, resources, title, validate)
File "/Users/bryan/work/bokeh/bokeh/io.py", line 447, in _save_helper
html = standalone_html_page_for_models(obj, resources, title)
File "/Users/bryan/work/bokeh/bokeh/embed.py", line 600, in standalone_html_page_for_models
return file_html(models, resources, title)
File "/Users/bryan/work/bokeh/bokeh/embed.py", line 309, in file_html
bundle = _bundle_for_objs_and_resources(models, resources)
File "/Users/bryan/work/bokeh/bokeh/embed.py", line 206, in _bundle_for_objs_and_resources
bokeh_js = js_resources.render_js()
File "/Users/bryan/work/bokeh/bokeh/resources.py", line 395, in render_js
return JS_RESOURCES.render(js_raw=self.js_raw, js_files=self.js_files)
File "/Users/bryan/work/bokeh/bokeh/resources.py", line 388, in js_raw
custom_models = gen_custom_models_static()
File "/Users/bryan/work/bokeh/bokeh/util/compiler.py", line 298, in gen_custom_models_static
_run_npm(["install"] + [ name + "@" + version for (name, version) in dependencies ])
File "/Users/bryan/work/bokeh/bokeh/util/compiler.py", line 149, in _run_npm
raise RuntimeError(errout)
RuntimeError: b"npm WARN enoent ENOENT: no such file or directory, open '/Users/bryan/work/bokeh/examples/custom/font-awesome/package.json'\nnpm WARN font-awesome No description\nnpm WARN font-awesome No repository field.\nnpm WARN font-awesome No README data\nnpm WARN font-awesome No license field.\n"

# Fixed code
def _run_nodejs(script, input):
    if _nodejs is None:
        raise RuntimeError(
            "node.js is needed to allow compilation of custom models "
            + '("conda install -c bokeh nodejs" or follow https://nodejs.org/en/download/)'
        )

    proc = Popen([_nodejs, script], stdout=PIPE, stderr=PIPE, stdin=PIPE)
    (stdout, errout) = proc.communicate(input=json.dumps(input).encode())

    if proc.returncode != 0:
        raise RuntimeError(errout)
    else:
        return AttrDict(json.loads(stdout.decode()))