opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Windows Installation dosn't work

Open mrAibo opened this issue 1 year ago • 6 comments

npm i -g opencode-ai@latest
npm warn cleanup Failed to remove some directories [
npm warn cleanup   [
npm warn cleanup     '\\\\?\\C:\\Users\\*****\\AppData\\Roaming\\npm\\node_modules\\opencode-ai\\node_modules\\opencode-windows-x64',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\crown\AppData\Roaming\npm\node_modules\opencode-ai\node_modules\opencode-windows-x64'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'C:\\Users\\*****\\AppData\\Roaming\\npm\\node_modules\\opencode-ai\\node_modules\\opencode-windows-x64'
npm warn cleanup     }
npm warn cleanup   ]
npm warn cleanup ]
npm error code 1
npm error path C:\Users\*****\AppData\Roaming\npm\node_modules\opencode-ai
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node ./postinstall.mjs
npm error Failed to create opencode binary symlink: Could not find package opencode-win32-x64: Cannot find module 'opencode-win32-x64/package.json'
npm error Require stack:
npm error - C:\Users\*****\AppData\Roaming\npm\node_modules\opencode-ai\postinstall.mjs
npm error A complete log of this run can be found in: C:\Users\*****\AppData\Local\npm-cache\_logs\2025-07-01T23_53_58_259Z-debug-0.log

mrAibo avatar Jul 01 '25 23:07 mrAibo

issue(Tester), "https://registry.npmjs.org/opencode-ainpm" -- > Nothing was found. "Could not find package opencode-win32-x64" < -- opencode-ainpm

zico20047 avatar Jul 02 '25 03:07 zico20047

C:\Users\user>npm install -g opencode-ai npm error code 1 npm error path C:\Users\user\AppData\Roaming\npm\node_modules\opencode-ai npm error command failed npm error command C:\Windows\system32\cmd.exe /d /s /c node ./postinstall.mjs npm error Failed to create opencode binary symlink: Could not find package opencode-win32-x64: Cannot find module 'opencode-win32-x64/package.json' npm error Require stack: npm error - C:\Users\user\AppData\Roaming\npm\node_modules\opencode-ai\postinstall.mjs npm error A complete log of this run can be found in: C:\Users\user\AppData\Local\npm-cache_logs\2025-07-02T06_59_25_587Z-debug-0.log

gitmeatarru avatar Jul 02 '25 07:07 gitmeatarru

@mrAibo @gitmeatarru @zico20047 this error usually happens because the Windows-specific binary package opencode-win32-x64 is either missing or the installer can’t access it properly.

To fix this, you can try two things:

Clean up old versions: Manually delete the opencode-ai folder from your global npm modules directory (usually under C:\Users\<your-username>\AppData\Roaming\npm\node_modules\) to remove any partially installed or corrupted files.

Install using the official installer script instead of npm: Run this command in your terminal:

curl -fsSL https://opencode.ai/install | bash This method downloads the proper binary directly and avoids the npm postinstall issues on Windows.

ghost avatar Jul 02 '25 10:07 ghost

@mrAibo @gitmeatarru @zico20047 this error usually happens because the Windows-specific binary package opencode-win32-x64 is either missing or the installer can’t access it properly.

To fix this, you can try two things:

Clean up old versions: Manually delete the opencode-ai folder from your global npm modules directory (usually under C:\Users\<your-username>\AppData\Roaming\npm\node_modules\) to remove any partially installed or corrupted files.

Install using the official installer script instead of npm: Run this command in your terminal:

curl -fsSL https://opencode.ai/install | bash This method downloads the proper binary directly and avoids the npm postinstall issues on Windows.

curl -fsSL https://opencode.ai/install | bash <3>WSL (11 - Relay) ERROR: CreateProcessCommon:640: execvpe(/bin/bash) failed: No such file or directory

gitmeatarru avatar Jul 02 '25 12:07 gitmeatarru

in Windows you havn't native Bash shell and rmdir command too from error.

mrAibo avatar Jul 02 '25 12:07 mrAibo

closing in favor of #663

thdxr avatar Jul 03 '25 04:07 thdxr