ERPNext Conference 2019* Blog

[Release] Instructions for updating to/staying on v10/v11



Hi @vrms,

Go to ERPNext’s folder, open .git/config and make sure it is set up to fetch all branches in upstream:

fetch = +refs/heads/*:refs/remotes/upstream/*


After this run git fetch too.
Then you will be able to run bench switch-to-branch ...

This happens due to shallow cloning.


thanks @chdecultot

my erpnext/.git.config (after replacing the staging with * looks like this now

       repositoryformatversion = 0
       filemode = true
       bare = false
       logallrefupdates = true
[remote "upstream"]
       url =
       fetch = +refs/heads/staging:refs/remotes/upstream/*
[branch "staging"]
       remote = upstream
       merge = refs/heads/staging

even though this is the same as in the config file of frappe it is still not working out

~/frappe-bench$ bench switch-to-branch master erpnext --upgrade
fatal: Invalid refspec '+refs/heads/staging:refs/remotes/upstream/*'
Branch master does not exist in Upstream for erpnext
Switched to master
Please run `bench update --patch` to be safe from any differences in database schema

       repositoryformatversion = 0
       filemode = true
       bare = false
       logallrefupdates = true
[remote "upstream"]
       url =
       fetch = +refs/heads/*:refs/remotes/upstream/*
[branch "staging"]
       remote = upstream
       merge = refs/heads/staging

@vrms this is what you want

and this too:


looks like this is what I have (see above)

~/frappe-bench/apps/erpnext$ git fetch
fatal: Invalid refspec '+refs/heads/staging:refs/remotes/upstream/*'


use the config from here:

[Release] ERPNext Version 12

This worked for me. Thank you!


sorry I overlooked the first * in the fetch = +refs ... line


What is the official advice how to do backup of the whole ERPNext before upgrading it?


@generare This is the official way to do it:

bench --site [your site name] backup


Added instructions for removal of frappe_io and foundation apps:


Got this error when updating my testing instance on ESXi/Ubuntu 16.04.

Updating node packages...
INFO:bench.utils:yarn install
yarn install v1.13.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "rollup-plugin-vue > @vue/component-compiler@3.4.4" has unmet peer dependency "postcss@>=6.0".
[4/4] Building fresh packages...
Done in 18.41s.
Reloading bench...
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/.bench/bench/", line 40, in cli
  File "/usr/local/lib/python2.7/dist-packages/click/", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/.bench/bench/commands/", 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/", line 85, in _update
UnboundLocalError: local variable 'reload' referenced before assignment

Started bench update again and after second pass everything seems to be finished and OK


This was detected and fixed immediately. So it ran successfully when re-run.


Thanks… so if I try it now, it will be successful on the first run?


Yes, I think so. Please report if that’s not the case.


OK, I will try it once again. System will be consistent even after two-pass-update?


Yeah, shouldn’t be an issue


Just got the same error, when tried to update on ESXi/Centos7. Tried also on VirtualBox/Ubuntu18.04 and got also the same error.


And works fine on re-running?
EDIT: Sorry, had fixed another issue with same error message. Thanks for reporting.


Okey, I’ll give it another try, have snapshots before update