[Bug Report]
Summary
Plugin fails to load with error Cannot find module 'openclaw/plugin-sdk/channel-config-schema' when openclaw is globally installed on Windows.
Steps to Reproduce
- Install openclaw globally via npm:
npm install -g openclaw
- Install a plugin:
npx -y @tencent-weixin/openclaw-weixin-cli@latest install
- Start openclaw gateway:
openclaw gateway
- Observe error:
[plugins] openclaw-weixin failed to load from C:\Users\gzsia\.openclaw\extensions\openclaw-weixin\index.ts: Error: Cannot find module 'openclaw/plugin-sdk/channel-config-schema'
Expected Behavior
Plugins should load correctly when openclaw is installed globally via npm.
Actual Behavior
Plugin loader's resolveLoaderPluginSdkPackageRoot() traverses upward from plugin directory (C:\Users\gzsia\.openclaw\extensions\openclaw-weixin\) to find openclaw package root. However, when openclaw is globally installed via npm, its location (C:\Users\gzsia\AppData\Roaming\npm\node_modules\openclaw) is not in any parent directory of plugin directory.
As a result:
resolvePluginSdkScopedAliasMap() returns an empty object {}
- Only base
"openclaw/plugin-sdk" alias (pointing to root-alias.cjs) is registered
- Subpath aliases like
"openclaw/plugin-sdk/channel-config-schema" are missing
- Jiti fails to resolve import and throws
Cannot find module
Environment
- OS: Windows 11
- openclaw version: 2026.3.23-2
- Plugin: @tencent-weixin/openclaw-weixin v2.0.1
Workaround
Create a junction from plugin's node_modules to the globally installed openclaw:
New-Item -ItemType Directory -Path "C:\Users\gzsia\.openclaw\extensions\openclaw-weixin\node_modules" -Force
cmd /c mklink /J "C:\Users\gzsia\.openclaw\extensions\openclaw-weixin\node_modules\openclaw" ^
"C:\Users\gzsia\AppData\Roaming\npm\node_modules\openclaw"
This allows Node's native module resolution to find openclaw, bypassing the broken alias mechanism.
Suggested Fix
resolveLoaderPluginSdkPackageRoot() should fall back to additional search strategies when parent traversal fails:
- Check
process.env.PATH for npm global directories
- Use
npm config get prefix to locate global npm installation
- Leverage Node's native module resolution via
require.resolve('openclaw') or import.meta.resolve('openclaw')
Alternatively, allow users to explicitly specify the openclaw package root via an environment variable or configuration option.
Note: This is a cross-session bug affecting all Windows users with global openclaw installations.
[Bug Report]
Summary
Plugin fails to load with error
Cannot find module 'openclaw/plugin-sdk/channel-config-schema'when openclaw is globally installed on Windows.Steps to Reproduce
npm install -g openclawnpx -y @tencent-weixin/openclaw-weixin-cli@latest installopenclaw gatewayExpected Behavior
Plugins should load correctly when openclaw is installed globally via npm.
Actual Behavior
Plugin loader's
resolveLoaderPluginSdkPackageRoot()traverses upward from plugin directory (C:\Users\gzsia\.openclaw\extensions\openclaw-weixin\) to find openclaw package root. However, when openclaw is globally installed via npm, its location (C:\Users\gzsia\AppData\Roaming\npm\node_modules\openclaw) is not in any parent directory of plugin directory.As a result:
resolvePluginSdkScopedAliasMap()returns an empty object{}"openclaw/plugin-sdk"alias (pointing toroot-alias.cjs) is registered"openclaw/plugin-sdk/channel-config-schema"are missingCannot find moduleEnvironment
Workaround
Create a junction from plugin's
node_modulesto the globally installed openclaw:This allows Node's native module resolution to find openclaw, bypassing the broken alias mechanism.
Suggested Fix
resolveLoaderPluginSdkPackageRoot()should fall back to additional search strategies when parent traversal fails:process.env.PATHfor npm global directoriesnpm config get prefixto locate global npm installationrequire.resolve('openclaw')orimport.meta.resolve('openclaw')Alternatively, allow users to explicitly specify the openclaw package root via an environment variable or configuration option.
Note: This is a cross-session bug affecting all Windows users with global openclaw installations.