为什么重启 git bash 后运行 opencode 提示 post-install 没有运行
每一次在 vscode 重启后重新开启 git bash, 都无法正确运行 opencode 命令, 会出现以下报错:
1 | ASUS@LAPTOP-CN9D0PCU MINGW64 /d/Coding/projects/todo-canvas (main) $ opencode |
在深入阅读了 opencode 命令执行的结果后, 我找到了原因. postinstall.mjs 这个文件唯一的作用就是将对应平台的 opencode 可执行二进制文件复制并放置到 node_modules/opencode-ai/bin/opencode.exe 中. 在执行 postinstall.mjs 脚本之前, 该目录中存放了一个占位符 opencode.exe 文件, 无法执行. 所以会产生报错.
但为什么执行之后又会被替代呢?
- Title: 为什么重启 git bash 后运行 opencode 提示 post-install 没有运行
- Author: Ivan
- Created at : 2026-08-30 00:00:00
- Updated at : 2026-10-23 18:02:31
- Link: https://ivanfan-van.github.io/2026/08/30/note-3-growing-012/
- License: This work is licensed under CC BY-NC-SA 4.0.