インストール中にwscatが破損しました。

インストール中にwscatが破損しました。

wscatが破損しています。理由が何なのかわかりません。私はこのツールを定期的に使用しており、以前は見たことがありません。

Ubuntu 20.04

# npm install -g wscat

added 9 packages in 2s

root@simp:~# wscat 
node:internal/modules/cjs/loader:988
  throw err;
  ^

Error: Cannot find module 'debug'
Require stack:
- /usr/lib/x86_64-linux-gnu/nodejs/ws/node_modules/https-proxy-agent/index.js
- /usr/lib/x86_64-linux-gnu/nodejs/wscat/bin/wscat
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
    at Function.Module._load (node:internal/modules/cjs/loader:833:27)
    at Module.require (node:internal/modules/cjs/loader:1057:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/usr/lib/x86_64-linux-gnu/nodejs/ws/node_modules/https-proxy-agent/index.js:11:13)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
    at Module.require (node:internal/modules/cjs/loader:1057:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/lib/x86_64-linux-gnu/nodejs/ws/node_modules/https-proxy-agent/index.js',
    '/usr/lib/x86_64-linux-gnu/nodejs/wscat/bin/wscat'
  ]
}

ベストアンサー1

次のコマンドを使用すると、wscatUbuntu 20.04およびUbuntu 22.04で作業ツールを入手できます。

apt-get update && apt-get install -y --no-install-recommends ca-certificates node-ws

その後、それを使用してWebソケット接続をデバッグできます。

> wscat -c "wss://example.com/ws"
Connected (press CTRL+C to quit)
< 4
< {response from example.com}

おすすめ記事