ERPNext Installation issue over Ubuntu 24.04

Guys I am using Ubuntu over time know a little bit of Linux cli. tried troubleshooting with nginx, redis. but gave up. this is my last resource to get help by posting in the forum. hope to get help.

following is the bench error with ERPnext.
########################

rjbipl@rjbipl-ThinkPad-L540:~/frappe-bench$ bench get-app erpnext --branch version-15
A directory for the application ‘erpnext’ already exists. Do you want to continue and overwrite it? [y/N]: y
INFO: App moved from apps/erpnext to archived/apps/erpnext-2024-11-19_11
Getting erpnext
$ git clone GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) --branch version-15 --depth 1 --origin upstream
Cloning into ‘erpnext’…
remote: Enumerating objects: 4765, done.
remote: Counting objects: 100% (4765/4765), done.
remote: Compressing objects: 100% (4037/4037), done.
Receiving objects: 100% (4765/4765), 16.26 MiB | 3.31 MiB/s, done.
remote: Total 4765 (delta 971), reused 2058 (delta 509), pack-reused 0 (from 0)
Resolving deltas: 100% (971/971), done.
Ignoring dependencies of erpnext. To install dependencies use --resolve-deps
Installing erpnext
$ /home/rjbipl/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/rjbipl/frappe-bench/apps/erpnext
$ yarn install --check-files
yarn install v1.22.22
warning …/…/package.json: No license field
[1/4] Resolving packages…
[2/4] Fetching packages…
[3/4] Linking dependencies…
[4/4] Building fresh packages…
Done in 0.26s.
$ bench build --app erpnext
Traceback (most recent call last):
File “”, line 198, in _run_module_as_main
File “”, line 88, in _run_code
File “/home/rjbipl/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 114, in
main()
File “/home/rjbipl/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 20, in main
click.Group(commands=commands)(prog_name=“bench”)
File “/home/rjbipl/frappe-bench/env/lib/python3.12/site-packages/click/core.py”, line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/rjbipl/frappe-bench/env/lib/python3.12/site-packages/click/core.py”, line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File “/home/rjbipl/frappe-bench/env/lib/python3.12/site-packages/click/core.py”, line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/rjbipl/frappe-bench/env/lib/python3.12/site-packages/click/core.py”, line 1685, in invoke
super().invoke(ctx)
File “/home/rjbipl/frappe-bench/env/lib/python3.12/site-packages/click/core.py”, line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/rjbipl/frappe-bench/env/lib/python3.12/site-packages/click/core.py”, line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/rjbipl/frappe-bench/env/lib/python3.12/site-packages/click/decorators.py”, line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/rjbipl/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 44, in app_group
ctx.obj = {“sites”: get_sites(site), “force”: force, “verbose”: verbose, “profile”: profile}
^^^^^^^^^^^^^^^
File “/home/rjbipl/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 56, in get_sites
elif default_site := frappe.get_conf().default_site:
^^^^^^^^^^^^^^^^^
File “/home/rjbipl/frappe-bench/apps/frappe/frappe/init.py”, line 458, in get_conf
with init_site(site):
File “/home/rjbipl/frappe-bench/apps/frappe/frappe/init.py”, line 468, in enter
init(self.site)
File “/home/rjbipl/frappe-bench/apps/frappe/frappe/init.py”, line 306, in init
setup_redis_cache_connection()
File “/home/rjbipl/frappe-bench/apps/frappe/frappe/init.py”, line 488, in setup_redis_cache_connection
from frappe.utils.redis_wrapper import setup_cache
File “/home/rjbipl/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 7, in
from redis.commands.search import Search
ModuleNotFoundError: No module named ‘redis.commands’
ERROR: bench build --app erpnext
subprocess.CalledProcessError: Command ‘bench build --app erpnext’ returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
^^^^^
File “/usr/local/lib/python3.12/dist-packages/bench/cli.py”, line 132, in cli
bench_command()
File “/usr/local/lib/python3.12/dist-packages/bench/commands/make.py”, line 181, in get_app
get_app(
File “/usr/local/lib/python3.12/dist-packages/bench/app.py”, line 777, in get_app
app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
File “/usr/local/lib/python3.12/dist-packages/bench/utils/render.py”, line 126, in wrapper_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/dist-packages/bench/app.py”, line 254, in install
install_app(
File “/usr/local/lib/python3.12/dist-packages/bench/app.py”, line 925, in install_app
build_assets(bench_path=bench_path, app=app, using_cached=using_cached)
File “/usr/local/lib/python3.12/dist-packages/bench/utils/bench.py”, line 380, in build_assets
exec_cmd(command, cwd=bench_path, env=env)
File “/usr/local/lib/python3.12/dist-packages/bench/utils/init.py”, line 178, in exec_cmd
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: bench build --app erpnext

#############################

Hi,

It may help to say what instructions were followed to install Frappe. Try uninstalling Erpnext from the site then reinstalling the site.

https://frappeframework.com/docs/user/en/bench/reference/uninstall-app

@smino He was getting the ERPNext app, not installing it.

@rajsharmav12 I think you are using frappe v16 (current default version) instead of v15. You can install Frappe v15 along with ERPNext v15 as I did:

bench init --dev --frappe-branch version-15 ~/frappe-dev
  • Change ~/frappe-dev to your preferred folder.
  • Delete the --dev option from the above command if you are setting up a production environment.

Go to the bench folder ~/frappe-dev then get the ERPNext app:

cd ~/frappe-dev
bench get-app --branch version-15 https://github.com/frappe/erpnext --resolve-deps

Thanks @tunggnu . Would it make sense to remove ERPNext completely before trying this or use the --overwrite option ?

My first command will create a new bench. The second command will get the ERPNext app into that bench. So, he will work on the new bench instead of the old one.

rjbipl@rjbipl-ThinkPad-L540:~/frappe-bench$ bench init --dev --frappe-branch version-15 ~/frappe-dev
Setting Up Environment
$ python3 -m venv env
$ /home/rjbipl/frappe-dev/env/bin/python -m pip install --quiet --upgrade pip
$ /home/rjbipl/frappe-dev/env/bin/python -m pip install --quiet wheel
Getting frappe
$ git clone GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript --branch version-15 --depth 1 --origin upstream
Cloning into ‘frappe’…
remote: Enumerating objects: 3325, done.
remote: Counting objects: 100% (3325/3325), done.
remote: Compressing objects: 100% (2999/2999), done.
remote: Total 3325 (delta 422), reused 1472 (delta 213), pack-reused 0 (from 0)
Receiving objects: 100% (3325/3325), 16.15 MiB | 3.75 MiB/s, done.
Resolving deltas: 100% (422/422), done.
Installing frappe
$ /home/rjbipl/frappe-dev/env/bin/python -m pip install --quiet --upgrade -e /home/rjbipl/frappe-dev/apps/frappe
$ /home/rjbipl/frappe-dev/env/bin/python -m pip install --quiet --upgrade coverage~=6.5.0 Faker~=18.10.1 pyngrok~=6.0.0 unittest-xml-reporting~=3.2.0 watchdog~=3.0.0 hypothesis~=6.77.0 responses==0.23.1 freezegun~=1.2.2
$ yarn install --check-files
yarn install v1.22.22
[1/5] Validating package.json…
error frappe-framework@: The engine “node” is incompatible with this module. Expected version “>=18”. Got “16.20.2”
error Found incompatible module.
info Visit yarn install | Yarn for documentation about this command.
subprocess.CalledProcessError: Command ‘yarn install --check-files’ returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/lib/python3.12/dist-packages/bench/commands/make.py”, line 75, in init
init(
File “/usr/local/lib/python3.12/dist-packages/bench/utils/render.py”, line 105, in wrapper_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/dist-packages/bench/utils/system.py”, line 87, in init
get_app(
File “/usr/local/lib/python3.12/dist-packages/bench/app.py”, line 777, in get_app
app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
File “/usr/local/lib/python3.12/dist-packages/bench/utils/render.py”, line 126, in wrapper_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/dist-packages/bench/app.py”, line 254, in install
install_app(
File “/usr/local/lib/python3.12/dist-packages/bench/app.py”, line 920, in install_app
bench.run(yarn_install, cwd=app_path)
File “/usr/local/lib/python3.12/dist-packages/bench/bench.py”, line 48, in run
return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/dist-packages/bench/utils/init.py”, line 178, in exec_cmd
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: yarn install --check-files

ERROR: There was a problem while creating /home/rjbipl/frappe-dev
Do you want to rollback these changes? [y/N]: y
INFO: Rolling back Bench “/home/rjbipl/frappe-dev”
rjbipl@rjbipl-ThinkPad-L540:~/frappe-bench$ cd ~/frappe-dev
bash: cd: /home/rjbipl/frappe-dev: No such file or directory
#########################################################
Sir this is the error message i got. Later I created a directory with frappe-dev.
and tried to initialize bench
#########################################################
jbipl@rjbipl-ThinkPad-L540:~$ sudo mkdir frappe-dev
[sudo] password for rjbipl:
rjbipl@rjbipl-ThinkPad-L540:~$ cd frappe-
bash: cd: frappe-: No such file or directory
rjbipl@rjbipl-ThinkPad-L540:~$ cd frappe-bench/
rjbipl@rjbipl-ThinkPad-L540:~/frappe-bench$ bench init --dev --frappe-branch version-15 ~/frappe-dev
ERROR: Bench instance already exists at /home/rjbipl/frappe-dev
rjbipl@rjbipl-ThinkPad-L540:~/frappe-bench$ cd /
rjbipl@rjbipl-ThinkPad-L540:/$ ls
bin dev lib64 mnt sbin sys
bin.usr-is-merged etc lib.usr-is-merged opt sbin.usr-is-merged tmp
boot home libx32 proc snap usr
cdrom lib lost+found root srv var
debug lib32 media run swapfile
rjbipl@rjbipl-ThinkPad-L540:/$ cd home/
rjbipl@rjbipl-ThinkPad-L540:/home$ ls
rjbipl
rjbipl@rjbipl-ThinkPad-L540:/home$ cd rjbipl/
rjbipl@rjbipl-ThinkPad-L540:~$ ls
atom-1.60.0-amd64 frappe-bench rjcode
‘Calibre Library’ frappe-dev snap
Desktop JavaScript-for-Absolute-Beginners.pdf Templates
Documents javascript.pdf Videos
dotnet-install.sh Music wget-log
Downloads Pictures
eclipse-workspace Public
rjbipl@rjbipl-ThinkPad-L540:~$ cd frappe-dev/
rjbipl@rjbipl-ThinkPad-L540:~/frappe-dev$ bench get-app --branch version-15 GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) --resolve-deps
Following apps will be installed

  1. GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
    ERROR: /home/rjbipl/frappe-dev is not a valid bench directory. Run with --init-bench if you’d like to create a Bench too.
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 8, in
    sys.exit(cli())
    ^^^^^
    File “/usr/local/lib/python3.12/dist-packages/bench/cli.py”, line 132, in cli
    bench_command()
    File “/usr/lib/python3/dist-packages/click/core.py”, line 1157, in call
    return self.main(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File “/usr/lib/python3/dist-packages/click/core.py”, line 1078, in main
    rv = self.invoke(ctx)
    ^^^^^^^^^^^^^^^^
    File “/usr/lib/python3/dist-packages/click/core.py”, line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File “/usr/lib/python3/dist-packages/click/core.py”, line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File “/usr/lib/python3/dist-packages/click/core.py”, line 783, in invoke
    return __callback(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File “/usr/local/lib/python3.12/dist-packages/bench/commands/make.py”, line 181, in get_app
    get_app(
    File “/usr/local/lib/python3.12/dist-packages/bench/app.py”, line 709, in get_app
    raise NotInBenchDirectoryError(
    bench.exceptions.NotInBenchDirectoryError: /home/rjbipl/frappe-dev is not a valid bench directory. Run with --init-bench if you’d like to create a Bench too.
    rjbipl@rjbipl-ThinkPad-L540:~/frappe-dev$ cd …
    rjbipl@rjbipl-ThinkPad-L540:~$ ls
    atom-1.60.0-amd64 frappe-bench rjcode
    ‘Calibre Library’ frappe-dev snap
    Desktop JavaScript-for-Absolute-Beginners.pdf Templates
    Documents javascript.pdf Videos
    dotnet-install.sh Music wget-log
    Downloads Pictures
    eclipse-workspace Public
    rjbipl@rjbipl-ThinkPad-L540:~$ cd frappe-dev/
    rjbipl@rjbipl-ThinkPad-L540:~/frappe-dev$ ls
    rjbipl@rjbipl-ThinkPad-L540:~/frappe-dev$ cd …
    rjbipl@rjbipl-ThinkPad-L540:~$ cd frappe-bench/
    rjbipl@rjbipl-ThinkPad-L540:~/frappe-bench$ bench init --dev --frappe-branch version-15 ~/frappe-dev
    ERROR: Bench instance already exists at /home/rjbipl/frappe-dev
    Highly appreciate your Help

I think you need to change the destination for the second bench to , for example, ~/frappe-dev2

If you want to overwrite the existing bench folder, add --ignore-exist to the command

See bench init --help for other options.

This is the first issue: you are using NodeJS v16.20.2 but Frappe requires NodeJS at least v18.x. You need to install a new version of NodeJS first.

By default, the bench init command will automatically create a new folder. So, if you specify an existing folder in the bench init command, it will fail. You should remove the ~/frappe-dev folder before run the benhc init command or add --ignore-exist to the command as mentioned by @smino.

If you don’t set up the bench properly, all other commands will be invalid. Pay attention to error messages and resolve them properly.

Thank You Sir your have been very help full.
I have troubleshooted node issue and was able to init frappe-dev.
**installed dcode.com and erpnext app. **
but now new issue arise i hope you can extend your help with the same.
###############################################################
rjbipl@rjbipl-ThinkPad-L540:~/frappe-dev$ bench start
21:30:48 system | redis_cache.1 started (pid=25791)
21:30:48 system | redis_queue.1 started (pid=25797)
21:30:48 system | watch.1 started (pid=25804)
21:30:48 system | socketio.1 started (pid=25808)
21:30:48 system | web.1 started (pid=25799)
21:30:48 system | worker.1 started (pid=25810)
21:30:48 system | schedule.1 started (pid=25805)
21:30:48 redis_queue.1 | 25800:C 26 Nov 2024 21:30:48.807 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
21:30:48 redis_queue.1 | 25800:C 26 Nov 2024 21:30:48.807 # Redis version=7.0.15, bits=64, commit=00000000, modified=0, pid=25800, just started
21:30:48 redis_queue.1 | 25800:C 26 Nov 2024 21:30:48.807 # Configuration loaded
21:30:48 redis_queue.1 | 25800:M 26 Nov 2024 21:30:48.808 * Increased maximum number of open files to 10032 (it was originally set to 1024).
21:30:48 redis_queue.1 | 25800:M 26 Nov 2024 21:30:48.808 * monotonic clock: POSIX clock_gettime
21:30:48 redis_queue.1 | 25800:M 26 Nov 2024 21:30:48.813 * Running mode=standalone, port=11001.
21:30:48 redis_queue.1 | 25800:M 26 Nov 2024 21:30:48.813 # Server initialized
21:30:48 redis_queue.1 | 25800:M 26 Nov 2024 21:30:48.814 * Loading RDB produced by version 7.0.15
21:30:48 redis_cache.1 | 25793:C 26 Nov 2024 21:30:48.814 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
21:30:48 redis_cache.1 | 25793:C 26 Nov 2024 21:30:48.814 # Redis version=7.0.15, bits=64, commit=00000000, modified=0, pid=25793, just started
21:30:48 redis_cache.1 | 25793:C 26 Nov 2024 21:30:48.814 # Configuration loaded
21:30:48 redis_queue.1 | 25800:M 26 Nov 2024 21:30:48.814 * RDB age 395 seconds
21:30:48 redis_queue.1 | 25800:M 26 Nov 2024 21:30:48.814 * RDB memory usage when created 1.19 Mb
21:30:48 redis_queue.1 | 25800:M 26 Nov 2024 21:30:48.814 * Done loading RDB, keys loaded: 3, keys expired: 1.
21:30:48 redis_queue.1 | 25800:M 26 Nov 2024 21:30:48.814 * DB loaded from disk: 0.000 seconds
21:30:48 redis_queue.1 | 25800:M 26 Nov 2024 21:30:48.814 * Ready to accept connections
21:30:48 redis_cache.1 | 25793:M 26 Nov 2024 21:30:48.815 * Increased maximum number of open files to 10032 (it was originally set to 1024).
21:30:48 redis_cache.1 | 25793:M 26 Nov 2024 21:30:48.815 * monotonic clock: POSIX clock_gettime
21:30:48 redis_cache.1 | 25793:M 26 Nov 2024 21:30:48.816 * Running mode=standalone, port=13001.
21:30:48 redis_cache.1 | 25793:M 26 Nov 2024 21:30:48.823 # Server initialized
21:30:48 redis_cache.1 | 25793:M 26 Nov 2024 21:30:48.823 * Ready to accept connections
21:30:49 socketio.1 | Realtime service listening on: 9001
21:30:50 watch.1 |
21:30:50 web.1 | /home/rjbipl/frappe-dev/env/lib/python3.12/site-packages/passlib/utils/init.py:854: DeprecationWarning: ‘crypt’ is deprecated and slated for removal in Python 3.13
21:30:50 web.1 | from crypt import crypt as _crypt
21:30:50 web.1 | WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
21:30:50 web.1 | * Running on all addresses (0.0.0.0)
21:30:50 web.1 | * Running on http://127.0.0.1:8001
21:30:50 web.1 | * Running on http://192.168.29.197:8001
21:30:50 web.1 | Press CTRL+C to quit
21:30:50 web.1 | * Restarting with watchdog (inotify)
21:30:50 watch.1 | yarn run v1.22.22
21:30:50 watch.1 | warning …/…/package.json: No license field
21:30:50 watch.1 | $ node esbuild --watch --live-reload
21:30:51 web.1 | /home/rjbipl/frappe-dev/env/lib/python3.12/site-packages/passlib/utils/init.py:854: DeprecationWarning: ‘crypt’ is deprecated and slated for removal in Python 3.13
21:30:51 web.1 | from crypt import crypt as _crypt
21:30:51 web.1 | * Debugger is active!
21:30:51 web.1 | * Debugger PIN: 102-958-185
21:30:59 watch.1 | Browserslist: caniuse-lite is outdated. Please run:
21:30:59 watch.1 | npx update-browserslist-db@latest
21:30:59 watch.1 | Why you should do it regularly: GitHub - browserslist/update-db: CLI tool to update caniuse-lite to refresh target browsers from Browserslist config
21:31:18 watch.1 | Watching for changes…
21:31:22 web.1 | 127.0.0.1 - - [26/Nov/2024 21:31:22] “GET / HTTP/1.1” 404 -
21:31:32 web.1 | 192.168.29.197 - - [26/Nov/2024 21:31:32] “GET / HTTP/1.1” 404 -

@rajsharmav12 Follow the instruction above to get the ERPNext app for your bench.

Finally, follow this guide to create your website: Create a Site

Don’t forget to replace library.localhost with your domain, and library_management with erpnext.

A detailed guide to follow when setting up version 15

Thank You Sir
Finally got it Frappe Going. Done.