Issue upgrade ERPNext V12 to V13 " expected str, bytes or os.PathLike object, not NoneType"

Environment:
ERPNext: 12.3
Frappe: 12.28.2
Bench: 5.0.0
Python: 3.7.6
NodeJS: v12.22.12

After running the following command “bench switch-to-branch version-13 --upgrade” I get the following error:

Backup for Site erpnext has been successfully completed
Migrating erpnext
Traceback (most recent call last):
File “/opt/bitnami/python/lib/python3.7/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/opt/bitnami/python/lib/python3.7/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 110, in
main()
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 20, in main
click.Group(commands=commands)(prog_name=“bench”)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/env/lib/python3.7/site-packages/click/decorators.py”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/commands/init.py”, line 31, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/commands/site.py”, line 433, in migrate
migrate(context.verbose, skip_failing=skip_failing, skip_search_index=skip_search_index)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/migrate.py”, line 65, in migrate
clear_global_cache()
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/cache_manager.py”, line 105, in clear_global_cache
frappe.setup_module_map()
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/init.py”, line 1388, in setup_module_map
for module in get_module_list(app):
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/init.py”, line 1249, in get_module_list
return get_file_items(os.path.join(os.path.dirname(get_module(app_name).file), “modules.txt”))
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/env/lib/python3.7/posixpath.py”, line 156, in dirname
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

any help is highly appreciated.