Skip to content

Commit 79417e5

Browse files
author
sheeek
committed
Fix clawdbot command not found - configure pnpm paths correctly
- Configure pnpm global-bin-dir to ~/.local/bin - Add ~/.local/bin to PATH in .bashrc - Update systemd service to use correct bin path - Create both pnpm store and bin directories - Fixes: clawdbot command not found after installation
1 parent c582aaa commit 79417e5

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

roles/clawdbot/tasks/clawdbot.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@
1111
- { path: "{{ clawdbot_config_dir }}/sessions", mode: '0755' }
1212
- { path: "{{ clawdbot_config_dir }}/credentials", mode: '0700' }
1313

14+
- name: Create pnpm directories
15+
ansible.builtin.file:
16+
path: "{{ item }}"
17+
state: directory
18+
owner: "{{ clawdbot_user }}"
19+
group: "{{ clawdbot_user }}"
20+
mode: '0755'
21+
loop:
22+
- "{{ clawdbot_home }}/.local/share/pnpm"
23+
- "{{ clawdbot_home }}/.local/bin"
24+
25+
- name: Configure pnpm for clawdbot user
26+
ansible.builtin.shell:
27+
cmd: |
28+
pnpm config set global-dir {{ clawdbot_home }}/.local/share/pnpm
29+
pnpm config set global-bin-dir {{ clawdbot_home }}/.local/bin
30+
executable: /bin/bash
31+
become: true
32+
become_user: "{{ clawdbot_user }}"
33+
1434
- name: Install Clawdbot globally as clawdbot user
1535
ansible.builtin.shell:
1636
cmd: pnpm add -g clawdbot@latest
@@ -19,15 +39,15 @@
1939
become_user: "{{ clawdbot_user }}"
2040
environment:
2141
PNPM_HOME: "{{ clawdbot_home }}/.local/share/pnpm"
22-
PATH: "{{ clawdbot_home }}/.local/share/pnpm:{{ ansible_env.PATH }}"
2342

24-
- name: Create pnpm bin directory in user PATH
25-
ansible.builtin.file:
26-
path: "{{ clawdbot_home }}/.local/share/pnpm"
27-
state: directory
43+
- name: Add pnpm bin to PATH in .bashrc
44+
ansible.builtin.lineinfile:
45+
path: "{{ clawdbot_home }}/.bashrc"
46+
line: 'export PATH="{{ clawdbot_home }}/.local/bin:$PATH"'
47+
create: true
2848
owner: "{{ clawdbot_user }}"
2949
group: "{{ clawdbot_user }}"
30-
mode: '0755'
50+
mode: '0644'
3151

3252
- name: Generate Clawdbot config template
3353
ansible.builtin.template:

roles/clawdbot/templates/clawdbot-host.service.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Type=simple
88
User={{ clawdbot_user }}
99
Group={{ clawdbot_user }}
1010
WorkingDirectory={{ clawdbot_home }}
11-
Environment="PATH={{ clawdbot_home }}/.local/share/pnpm:/usr/local/bin:/usr/bin:/bin"
11+
Environment="PATH={{ clawdbot_home }}/.local/bin:/usr/local/bin:/usr/bin:/bin"
1212
Environment="PNPM_HOME={{ clawdbot_home }}/.local/share/pnpm"
13-
ExecStart={{ clawdbot_home }}/.local/share/pnpm/clawdbot gateway
13+
ExecStart={{ clawdbot_home }}/.local/bin/clawdbot gateway
1414
Restart=always
1515
RestartSec=10
1616

0 commit comments

Comments
 (0)