ERPNext bench command not found

Traceback (most recent call last):
2: from /usr/bin/bench:5:in <main>' 1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in require’
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require’: cannot load such file – bundler (LoadError)

Please help me with this error.

what is the command you executed?

I used this documentation.

I properly executed these two lines
-git clone GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps bench-repo
-pip install --user -e bench-repo
Then I tried to execute this line i got an error.
- bench init frappe-bench && cd frappe-bench

Command ‘bench’ not found, but can be installed with:

sudo apt install ruby-active-model-serializers

Use these below commands :
sudo useradd -m -s /bin/bash erpnextuser
sudo passwd erpnextuser
sudo usermod -aG sudo erpnextuser
sudo mkdir -p /opt/erpnext
sudo chown -R erpnextuser /opt/erpnext/
su - erpnextuser
cd /opt/erpnext
git clone GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps bench-repo
sudo pip install -e bench-repo
i think this would be the solution…

2 Likes

Thanks.
I found another solution which solved the problem which was adding one line in bashrc file.
Thanks for the help though.

Can you explain me what have done let me try too…

Just added this line in bashrc file
PATH=$PATH:~/.local/bin/
Then restarted shell using
exec bash

3 Likes

k thanks.

can you share the path where the bashrc file is located?

the bashrc is in your home subdir. In theory, this should allow you to edit it…

nano ~/.bashrc

1 Like

i tried this but still facing the same error.
could you please guide me where to add that line in .bashrc file

What you could try is start another terminal console session, that should reset the PATH environment variable.

This is the right solution

Could you explain this is non-developer terms? I didn’t get it. I am getting the same issue after following the steps from the Frappe Installation documentation from the official source.

nano ~/.bashrc
type this command editor will open.
Then add this line in the file.
PATH=$PATH:~/.local/bin/
Then restart shell using , exec bash.

This is only help i can do as i stopped working on erpNext. Last time i worked on erpNext was a year ago.

This particular problem originates from installing bench using pip without sudo it seems.

e.g.

pip install -e ./bench

vs

sudo pip install -e ./bench

2 Likes

What happen if after installed bench without sudo then I install again with sudo?
Will it confuse the whole system?

this solution works for me. thanks!

it works.