openclaw - 💡(How to fix) Fix [功能建议] exec 工具应自动加载用户的 shell 配置文件(如 ~/.zshrc) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#60165Fetched 2026-04-08 02:35:32
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants
RAW_BUFFERClick to expand / collapse

问题描述

OpenClaw 的 exec 工具在执行命令时,shell 环境没有自动加载用户的 ~/.zshrc 配置文件,导致 nvm/rbenv/pyenv 等版本管理器管理的工具无法被正确识别。

复现步骤

  1. 用户通过 nvm 安装了 node(如 v20.19.5)
  2. 在用户自己的终端中 node --version 正常输出
  3. OpenClaw 的 exec 工具执行 which node 返回「未找到」
  4. 需要手动 source ~/.nvm/nvm.sh 或硬编码 PATH 才能使用

期望行为

exec 工具应该以「登录 shell」方式启动(类似 zsh -l),自动加载用户的 shell 配置文件,正确继承 nvm 等工具的 PATH 设置。

建议方案

  1. exec 工具默认以登录 shell 方式启动
  2. 或者在 exec 环境初始化时自动检测并加载 nvm/rbenv/pyenv 等版本管理器的配置
  3. 或者在文档中明确说明需要用户手动 source 配置文件

影响

用户每次执行 node/npm 相关命令都需要手动添加 source ~/.nvm/nvm.sh 前缀,体验不够流畅。

环境

  • 系统:macOS (Darwin 25.1.0 arm64)
  • Shell:zsh
  • nvm 版本:已配置在 ~/.zshrc 中
  • OpenClaw 版本:2026.3.13

感谢关注!

extent analysis

TL;DR

Modify the OpenClaw exec tool to start with a login shell, similar to zsh -l, to automatically load the user's shell configuration file.

Guidance

  • Check the OpenClaw exec tool's documentation for any existing options or configurations that allow it to start with a login shell.
  • Consider modifying the exec tool to automatically detect and load version management configurations, such as nvm, rbenv, or pyenv.
  • As a temporary workaround, users can manually source their shell configuration file before executing commands, e.g., source ~/.zshrc or source ~/.nvm/nvm.sh.
  • Verify the fix by checking if the node --version command returns the correct version after executing which node in the OpenClaw exec tool.

Example

No code snippet is provided as it is not explicitly supported by the issue.

Notes

The solution may not apply to all versions of OpenClaw or nvm, and further testing is required to ensure compatibility.

Recommendation

Apply a workaround by modifying the OpenClaw exec tool to start with a login shell, as this is the most straightforward solution to the problem. This will allow the tool to automatically load the user's shell configuration file and correctly recognize version management tools.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [功能建议] exec 工具应自动加载用户的 shell 配置文件(如 ~/.zshrc) [1 participants]