frappe_docker: Can not update Website_Theme, Missing Node...

Description of the issue

Node.js problems to perform style generation. Edit, update or create a website theme style is not working. FileNotFound: [Error2] No such file or directory ‘node’:‘node’

Context information (for bug reports)

frappe_docker installed version12 New site install

Steps to reproduce the issue

  1. Use a clean frappe_docker setup
  2. Create new site
  3. Go to Website module, and edit standard theme. Save changes. Or create new theme and try to save changes.

image

Observed result RIGHT IMAGE

Message error: Node not found. Some tools running on node might not be working.

Expected result LEFT IMAGE

Changes are saved as in a bench install without docker.

Stacktrace / full error message if available

Log from <project>_erpnext-python_1 container

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
    doc.save()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 273, in save
    return self._save(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 296, in _save
    self.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 230, in insert
    self.run_before_save_methods()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 893, in run_before_save_methods
    self.run_method("validate")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 794, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1064, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1047, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 788, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/doctype/website_theme/website_theme.py", line 13, in validate
    self.validate_theme()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/doctype/website_theme/website_theme.py", line 43, in validate_theme
    self.generate_bootstrap_theme()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/doctype/website_theme/website_theme.py", line 66, in generate_bootstrap_theme
    process = Popen(command, cwd=frappe.get_app_path('frappe', '..'), stdout=PIPE, stderr=PIPE)
  File "/opt/bitnami/python/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/opt/bitnami/python/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'node': 'node'

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15

Most upvoted comments

This happens when node is installed via nvm

Check $ /usr/bin/node Gives output : -bash: /usr/bin/node: No such file or directory It should give:

Welcome to Node.js v14.19.0.
Type ".help" for more information.
> 

Solution: Make a symbolic link $ sudo ln -s $(which node) /usr/bin/

I think you’re right.

yarn add node-sass only happens in frappe-nginx

I sent a pr to frappe https://github.com/frappe/frappe/pull/11220

Generally in nodejs projects node-sass happens in development and only css assets are packed and served in production. In frappe theme changes happen with node-sass in production.

snyk shows there are security issues in node-sass to be kept in production.

@MarekPikula send a PR here that adds node-sass even in erpnext-nginx I’ll merge.