Try ERPNext Buy Support Partners Foundation

Bench update error - No such file or directory /apps/erpnext

On MacOS I’ve installed a fresh bench. When I perform a bench update I get the following error:

FileNotFoundError: [Errno 2] No such file or directory: './apps/erpnext': './apps/erpnext'

However, I haven’t installed the ERPNext app and don’t expect it to be referenced by a bench update. The steps followed were:

  1. bench init --python python3 frappe-bench-dev
  2. bench new-site default.local
  3. bench use default.local
  4. bench update

Below is the full trace of the error:

(env) chudeosiegbu@Chudes-MacBook-Pro frappe-bench-dev % bench update
INFO:bench.utils:Updating bench
INFO:bench.utils:git pull
Already up to date.
INFO:bench.utils:Bench Updated!
Traceback (most recent call last):
  File "/Users/chudeosiegbu/frappe-projects/env/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/Users/chudeosiegbu/frappe-projects/.bench/bench/cli.py", line 40, in cli
    bench_command()
  File "/Users/chudeosiegbu/frappe-projects/env/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/chudeosiegbu/frappe-projects/env/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/chudeosiegbu/frappe-projects/env/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/chudeosiegbu/frappe-projects/env/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/chudeosiegbu/frappe-projects/env/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/chudeosiegbu/frappe-projects/.bench/bench/commands/update.py", line 58, in update
    validate_branch()
  File "/Users/chudeosiegbu/frappe-projects/.bench/bench/app.py", line 427, in validate_branch
    branch = get_current_branch(app)
  File "/Users/chudeosiegbu/frappe-projects/.bench/bench/app.py", line 280, in get_current_branch
    return get_cmd_output("basename $(git symbolic-ref -q HEAD)", cwd=repo_dir)
  File "/Users/chudeosiegbu/frappe-projects/.bench/bench/utils.py", line 388, in get_cmd_output
    output = subprocess.check_output(cmd, cwd=cwd, shell=True, stderr=subprocess.PIPE).strip()
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 488, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/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: './apps/erpnext': './apps/erpnext'

Happy for any help I can get on this.

Hi @Chude_Osiegbu, greetings :slight_smile:

I think, this was happened because recently branch ( ‘version-12’ ) has been renamed to ‘v12’ at erpnext repo. And, they not have updated it yet in bench. I was too struggling with the same.

Workaround for now, hit this bench command and good to go.
bench get-app --branch v12 erpnext https://github.com/asharamseervi/erpnext

Have a wonderful day ahead.
PS: When I forked from ‘frappe/erpnext’ there was no branch like version-12, instead it was v12. And, I was installing with own forked version of erpnext.

1 Like

So, the issue seems to be from this commit:

For some reason, the commit assumes that the erpnext app is installed (which is wrong since I don’t want to install it and want to use frappe exclusively) and attempts to verify what branch of both frappe (which is okay) and erpnext (which is wrong) is installed. Of course, since I don’t have erpnext installed, it gives a no such file error when get_current_branch (‘erpnext’) is called.

@saurabh6790 is there any reason we’re assuming that the erpnext app must be installed during a bench update? The need to perform the kind of check being performed in validate_branch is a strong case for considering apps being able to add “bench update” hooks in their hooks.py

See PR with proposed correction below:

1 Like