Updating and staying in master branch

$ git clone GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps bench-repo
$ sudo pip install -e bench-repo/

lots of output, ending:

Installing collected packages: bench
  Found existing installation: bench 4.1.0
    Uninstalling bench-4.1.0:
      Successfully uninstalled bench-4.1.0
  Running setup.py develop for bench
Successfully installed bench

$ bench --version

4.1.0

$ bench init erpnext

lots of output, ending:

INFO:bench.utils:setting up backups
INFO:bench.utils:setting up auto update
Bench erpnext initialized

$ cd erpnext
$ bench version

frappe 12.x.x-develop

$ bench switch-to-master
$ bench version

frappe 10.1.51

$ bench get-app erpnext --branch master

Error: Cannot find module 'babel-core'

According to:

$ npm install babel-core less chokidar babel-preset-es2015 babel-preset-es2016 babel-preset-es2017 babel-preset-babili

Lots of output…

$ rm -rf apps/foundation apps/erpnext
$ bench get-app erpnext --branch master

Pages and pages of error:

ReferenceError: Unknown plugin “transform-object-rest-spread”

According to:

$ sudo npm install babel-plugin-transform-object-rest-spread
$ sudo npm install babel-preset-env

(getting fed up with having to wait 25 minutes each time to re-download the same large apps over and over just to get to the next error, but here goes take 3).

$ rm -rf apps/foundation apps/erpnext
$ bench get-app erpnext --branch master

/opt/bench/erpnext/apps/frappe/frappe/build.py:106: UserWarning: Source /opt/bench/erpnext/apps/frappe_io/frappe_io/docs does not exists.
  warnings.warn('Source {source} does not exists.'.format(source = source))
/opt/bench/erpnext/apps/frappe/frappe/build.py:106: UserWarning: Source /opt/bench/erpnext/apps/foundation/foundation/docs does not exists.
  warnings.warn('Source {source} does not exists.'.format(source = source))
SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at make_build_map (/opt/bench/erpnext/apps/frappe/frappe/build.js:193:22)
    at Object.<anonymous> (/opt/bench/erpnext/apps/frappe/frappe/build.js:22:17)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at make_build_map (/opt/bench/erpnext/apps/frappe/frappe/build.js:193:22)
    at Object.<anonymous> (/opt/bench/erpnext/apps/frappe/frappe/build.js:22:17)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
Wrote css/frappe-web.css - 65.11 KB
Wrote js/frappe-web.min.js - 132.77 KB
Wrote js/control.min.js - 77.04 KB
Wrote js/dialog.min.js - 116.9 KB
Wrote css/desk.min.css - 309.04 KB
Wrote css/frappe-rtl.css - 32.49 KB
Wrote js/libs.min.js - 1.13 MB
Wrote js/desk.min.js - 462.73 KB
Wrote css/module.min.css - 2.08 KB
Wrote css/form.min.css - 4.47 KB
Wrote js/form.min.js - 196.65 KB
Wrote css/list.min.css - 13.35 KB
Wrote js/list.min.js - 154.76 KB
Wrote css/report.min.css - 7.89 KB
Wrote js/report.min.js - 260.58 KB
Wrote js/web_form.min.js - 247.55 KB
Wrote css/web_form.css - 24.42 KB
Wrote js/print_format_v3.min.js - 23.39 KB
Wrote css/erpnext.css - 8 KB
Wrote js/erpnext-web.min.js - 3.8 KB
Wrote js/erpnext.min.js - 166.06 KB
Wrote js/item-dashboard.min.js - 8.13 KB

Not sure if the errors are good or bad, but it looks like it is installed

$ bench version

erpnext 10.1.58
foundation 0.0.1
frappe 10.1.51

$ bench new-site removed_name

MySQL root password:

Entered Password

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 94, in <module>
    main()
  File "/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/commands/site.py", line 34, in new_site
    verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force)
  File "/opt/bench/erpnext/apps/frappe/frappe/commands/site.py", line 65, in _new_site
    admin_password=admin_password, verbose=verbose, source_sql=source_sql,force=force, reinstall=reinstall)
  File "/opt/bench/erpnext/apps/frappe/frappe/installer.py", line 34, in install_db
    frappe.local.db = get_root_connection(root_login, root_password)
  File "/opt/bench/erpnext/apps/frappe/frappe/installer.py", line 103, in get_root_connection
    frappe.local.flags.root_connection = frappe.database.Database(user=root_login, password=root_password)
AttributeError: 'module' object has no attribute 'Database'

Any pointers on where I went wrong?