OpenClaw matrix plugin setup in docker

The OpenClaw matrix plugin has a npm dependency issue, it will cause error like

1[plugins] matrix: crypto runtime bootstrap failed: Cannot find module '@vector-im/matrix-bot-sdk'  
2Require stack:  
3- /app/extensions/matrix/src/matrix/deps.ts

Use openclaw plugins install @openclaw/matrix as mentioned if OpenClaw official document always result the docker container failed to start. I managed to use matrix in docker with the methods below:

Method 1

Just directly do npm install in matrix extension dir:

1cd /app/extensions/matrix && npm install

You need to ensure "/app/extensions/matrix" for plugins.load.paths in openclaw.json .

Method 2

The method1 is operated on a folder inside docker image, update docker image would need a reinstall. The method 2 would migrate the matrix plugin into /home/node/.openclw/extensions.

1mv /app/extensions/matrix/ ~/.openclaw/extensions/matrix/
2mkdir -p ~/.openclaw/extensions/shared/  
3cp /app/extensions/shared/channel-status-summary.ts ~/.openclaw/extensions/shared/  # copy necessary files from shared dir
4cd ~/.openclaw/extensions/matrix/ && npm install

You still need edit openclaw.json, add "/home/node/.openclaw/extensions/matrix" toplugins.load.paths .