UnhandledPromiseRejectionWarning: Error: invalid command ping www.google.com

オープン
#445 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
node.js, typescript

調査の方向性

提供された index.js の例から始め、node-ssh における execCommand("ping www.google.com") のエントリーポイントを追跡します。コマンドとその引数が switch にどのように送信されるかを確認し、その後、返されたエラーを手動セッションと比較します。再現手順が説明され、動作または使用方法が検証できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

I am attempting to connect to one of my network switches via ssh and just run the command ping www.google.com but get the following error:

node index.js
Ping Completed
(node:56662) UnhandledPromiseRejectionWarning: Error: invalid command www.google.com.
...

My config:

ssh
  .connect({
    host: "172.35.0.2",
    username: "admin",
    port: 22,
    password,
    // debug: console.log,
    algorithms: {
      kex: [
        "diffie-hellman-group1-sha1",
        "ecdh-sha2-nistp256",
        "ecdh-sha2-nistp384",
        "ecdh-sha2-nistp521",
        "diffie-hellman-group-exchange-sha256",
        "diffie-hellman-group14-sha1",
      ],
      cipher: [
        "3des-cbc",
        "aes128-ctr",
        "aes192-ctr",
        "aes256-ctr",
        "aes128-gcm",
        "[email protected]",
        "aes256-gcm",
        "[email protected]",
      ],
      serverHostKey: [
        "ssh-rsa",
        "ecdsa-sha2-nistp256",
        "ecdsa-sha2-nistp384",
        "ecdsa-sha2-nistp521",
      ],
      hmac: ["hmac-sha2-256", "hmac-sha2-512", "hmac-sha1"],
    },
  })
  .then(() => {
    ssh
      .execCommand("ping www.google.com", { options: { pty: true } })
      .then((result) => {
        console.log("STDOUT: " + result.stdout);
        console.log("STDERR: " + result.stderr);
      });
  })
  .then(
    function () {
      console.log("Ping Completed");
    },
    function (error) {
      console.log("Something's wrong");
      console.log(error);
    }
  );

What am I doing wrong?

I am able to manually connect to the switch and run ping successfully:

olt-lab-01# ping www.google.com
Resolving www.google.com... 172.217.170.100
 sent  rcvd  rate    rtt     avg    mdev     max     min  reply from
    1     1  100      20      20       0      20      20  172.217.170.100
    2     2  100      95      29      19      95      20  172.217.170.100
    3     3  100      18      28      17      95      18  172.217.170.100
olt-lab-01# 
主要言語
TypeScript
スター
1k
フォーク
94
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

steelbrain/node-ssh のほかの issue

steelbrain/node-ssh の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。