Bench Update From V10 to V11 CommandFailedError: yarn install

Hi Guys,

Today when I try bench update from V10 to V11, an “Yarn Install” error occurred.

I read through similar problems, and I tried to switch to develop and run
bench update --patch
cd apps/frappe
sudo yarn
bench update --reset

The problem still persists.

And I noticed that V11 is able to run with Python 3.5+, Great to hear that! May I know how can I run ERPNEXT with Python 3.5+?

It will be great help, thanks ahead!

INFO:bench.utils:yarn install

yarn install v1.15.2
error An unexpected error occurred: “EACCES: permission denied, scandir ‘/home/frappe/.config/yarn/link’”.
info If you think this is a bug, please open a bug report with the information provided in “/home/frappe/frappe-bench/apps/frappe/yarn-error.log”.
info Visit yarn install | Yarn for documentation about this command.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/update.py”, line 60, in update
_update(pull, patch, build, bench, auto, restart_supervisor, restart_systemd, requirements, no_backup, force=force, reset=reset)
File “/home/frappe/.bench/bench/commands/update.py”, line 77, in _update
update_node_packages(bench_path=bench_path)
File “/home/frappe/.bench/bench/utils.py”, line 449, in update_node_packages
update_yarn_packages(bench_path)
File “/home/frappe/.bench/bench/utils.py”, line 462, in update_yarn_packages
exec_cmd(‘yarn install’, cwd=app_path)
File “/home/frappe/.bench/bench/utils.py”, line 159, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: yarn install

Have a look at these…

@trentmu, Appreciate, I will look into the posts. Some of the posts I have already read through, but may be I didn’t read carefully.

And BTW, do you know how can I switch to python 3 after I update to V11? It is compulsory as python 2.7 will not be supported after 2020.

I believe the problem is the folder and file actually does not exist…

/frappe-bench$ cd /home/frappe/.config/yarn
-su: cd: /home/frappe/.config/yarn: No such file or directory

It works, I followed the first thread:
$ sudo chown -R frappe:frappe /usr/lib/node_modules
I just changed the folder to update owner and user to be the whole frappe user folder. And now I run bench update --reset, it works!!

Buuut, unluckily, after I try on the browser, the system is not working properly. The main page is not showing the styles properly, and when I tried to login, it also hang at verifying…

I opened the console, I saw a lot of errors:

Failed to load resource: net::ERR_SPDY_PROTOCOL_ERROR:
1 Failed to load resource: the server responded with a status of 500 ()
website.js:161 Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 52, in application
def application(request):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 116, in init_request
raise frappe.SessionStopped
File “/home/frappe/frappe-bench/apps/frappe/frappe/auth.py”, line 51, in init
frappe.local.login_manager = LoginManager()
File “/home/frappe/frappe-bench/apps/frappe/frappe/auth.py”, line 105, in init
if self.login()==False: return
File “/home/frappe/frappe-bench/apps/frappe/frappe/auth.py”, line 131, in login
self.post_login()
File “/home/frappe/frappe-bench/apps/frappe/frappe/auth.py”, line 138, in post_login
self.make_session()
File “/home/frappe/frappe-bench/apps/frappe/frappe/auth.py”, line 182, in make_session
full_name=self.full_name, user_type=self.user_type)
File “/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py”, line 205, in init
if self.user==‘Guest’:
File “/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py”, line 238, in start
def insert_session_record(self):
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 260, in save
return self._save(args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 296, in _save
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 886, in run_before_save_methods
self.set_title_field()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 781, in run_method
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1061, in composer
else throw Exception.“”"
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1044, in runner
+ doc_events.get("
", {}).get(method, []):
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 775, in
run_webhooks(self, method)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py”, line 69, in validate
ask_pass_update()
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py”, line 731, in ask_pass_update
# verify old password
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/init.py”, line 211, in set_default
return frappe.db.set_default(key, val)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py”, line 694, in set_default
File “/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py”, line 134, in set_default
add_default(key, value, parent)
File “/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py”, line 147, in add_default
d.insert(ignore_permissions=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 223, in insert
self._validate()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 457, in _validate
d._validate_length()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 806, in _extract_images_from_text_editor
if filters:
ImportError: cannot import name extract_images_from_doc

process_response @ website.js:161
:1 Failed to load resource: the server responded with a status of 500 ()
website.js:161 Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 52, in application
    def application(request):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 116, in init_request
    raise frappe.SessionStopped
  File "/home/frappe/frappe-bench/apps/frappe/frappe/auth.py", line 51, in __init__
    frappe.local.login_manager = LoginManager()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/auth.py", line 105, in __init__
    if self.login()==False: return
  File "/home/frappe/frappe-bench/apps/frappe/frappe/auth.py", line 131, in login
    self.post_login()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/auth.py", line 138, in post_login
    self.make_session()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/auth.py", line 182, in make_session
    full_name=self.full_name, user_type=self.user_type)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py", line 205, in __init__
    if self.user=='Guest':
  File "/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py", line 238, in start
    def insert_session_record(self):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 260, in save
    return self._save(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 296, in _save
    self.run_before_save_methods()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 886, in run_before_save_methods
    self.set_title_field()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 781, in run_method
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1061, in composer
    else throw Exception."""
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1044, in runner
    + doc_events.get("*", {}).get(method, []):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 775, in <lambda>
    run_webhooks(self, method)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 69, in validate
    ask_pass_update()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 731, in ask_pass_update
    # verify old password
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/__init__.py", line 211, in set_default
    return frappe.db.set_default(key, val)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py", line 694, in set_default
  File "/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py", line 134, in set_default
    add_default(key, value, parent)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py", line 147, in add_default
    d.insert(ignore_permissions=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 223, in insert
    self._validate()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 457, in _validate
    d._validate_length()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 806, in _extract_images_from_text_editor
    if filters:
ImportError: cannot import name extract_images_from_doc

process_response @ website.js:161

I tried a new browser, vivaldi, and open the incognito tab, which should exclude cookie or cache issue. I tried again. it is the same, but less errors at the condole:

Failed to load resource: the server responded with a status of 500 ()
website.js:161 Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 52, in application
    def application(request):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 116, in init_request
    raise frappe.SessionStopped
  File "/home/frappe/frappe-bench/apps/frappe/frappe/auth.py", line 51, in __init__
    frappe.local.login_manager = LoginManager()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/auth.py", line 105, in __init__
    if self.login()==False: return
  File "/home/frappe/frappe-bench/apps/frappe/frappe/auth.py", line 131, in login
    self.post_login()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/auth.py", line 138, in post_login
    self.make_session()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/auth.py", line 182, in make_session
    full_name=self.full_name, user_type=self.user_type)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py", line 205, in __init__
    if self.user=='Guest':
  File "/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py", line 238, in start
    def insert_session_record(self):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 260, in save
    return self._save(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 296, in _save
    self.run_before_save_methods()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 886, in run_before_save_methods
    self.set_title_field()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 781, in run_method
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1061, in composer
    else throw Exception."""
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1044, in runner
    + doc_events.get("*", {}).get(method, []):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 775, in <lambda>
    run_webhooks(self, method)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 69, in validate
    ask_pass_update()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 731, in ask_pass_update
    # verify old password
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/__init__.py", line 211, in set_default
    return frappe.db.set_default(key, val)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py", line 694, in set_default
  File "/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py", line 134, in set_default
    add_default(key, value, parent)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py", line 147, in add_default
    d.insert(ignore_permissions=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 223, in insert
    self._validate()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 457, in _validate
    d._validate_length()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 806, in _extract_images_from_text_editor
    if filters:
ImportError: cannot import name extract_images_from_doc

process_response @ website.js:161

I’ll let the smarter folks parse it all out… but given that:

  • 500 status popping up
  • surrounding npm / node updates

It may be somehow tied to the ssl stuff I’ve been running into with wkhtmltopdf, namely:

The really short and dumb guy (me) version is: the latest node has a req for a version of openssl1. …something, which, when installed, kills some older ssl packages that other processes rely on and who don’t know that the new openssl1. …something is even a thing.

**edit- fair warning- there’s a pretty high Baader–Meinhof phenomenon probability here.

@chancegold, thanks for your hint.

So it should be SSL issue?
BTW, I’m using Cloudflare SSL, on server side, it is Let’s Encrypt X3

…not necessarily? Like I disclaimed- I’ve been hammering on ssl issues all day, and when you hammer on anything all day, you have a tendency to see nails everywhere…

That being said- If you are running ubuntu 18.04 or 18.10 AND nodejs 10.x, this may indeed be ssl related. Higher odds if you recently moved to 18.04/updated to nodejs 10.x.

From the link-

The libssl1.0-dev package conflicts with the libssl-dev package, so this leads to all packages that depend on libssl1.0-dev to conflict with all packages that depend on libssl-dev; as well as all packages that depend on those packages (and so on).

[test case]

On a Bionic system (or Cosmic), install libssl-dev, and/or any package that depends on it:
http://qa.ubuntuwire.org/rdepends/v1/bionic/any/libssl-dev

Then, try to install libssl1.0-dev, or any package that depends on it:
http://qa.ubuntuwire.org/rdepends/v1/bionic/any/libssl1.0-dev

see comment 15 for an example of some packages that are force-removed when installing libssl1.0-dev, due to conflict.

Thanks for the info. I just checked my system and nodejs version

:~/frappe-bench$ nodejs --version
v8.12.0
:~/frappe-bench$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic

I don’t know if this will work on ubuntu 18.xx, but I have used it successfully on Debian 9.x - as a workaround for ssl issues for installing Viber - the principle should work the same.

The source of the info is here

Temporarily add the Debian 8 repositories. Edit your /etc/apt/sources.list file, and copy every stretch line, replacing stretch with jessie (so you end up with both stretch and jessie lines). Then run apt update, and apt install libssl1.0.0 should work.

cat <<EOF >> /etc/apt/sources.list
#Added these temporarily to get [viber+libssl1.0.0] working
deb http://debian.saix.net/ jessie main
deb-src http://debian.saix.net/ jessie main

deb http://security.debian.org/debian-security jessie/updates main
deb-src http://security.debian.org/debian-security jessie/updates main

deb http://debian.saix.net/ jessie-updates main
deb-src http://debian.saix.net/ jessie-updates main
EOF

sudo apt update && sudo apt install -y libssl1.0.0
#Now remove the jessie repo's
sudo sed -i "/Added these temporarily/d" /etc/apt/sources.list
sudo sed -i "/jessie/d" /etc/apt/sources.list
sudo sed -i "/\n\n\n/d" /etc/apt/sources.list
#and update again
sudo apt update

This will then add in the libssl version that you need, as well as the default, so it should remove the conflicts and allow you to proceed with the other pieces

@trentmu Thanks, I will try out, let’s see if it solve the problem or not.