When used on the renderer process of the Electron environment, the message "Class constructor NodeSSH cannot be invoked without 'new'" is displayed and instantiation fail.
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- electron, javascript
- 領域
- desktop
調査の方向性
まず Electron v18.1.0 で main.js、preload.js、index.js を使用して失敗を再現し、次に renderer process で window.requires.nodessh がどのように公開され、インスタンス化されているかを調べます。この Electron セットアップで報告された NodeSSH のインスタンス化エラーが発生しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hello.
I am considering the use of NodeSSH in the Electron environment.
I made the NodeSSH module available on the renderer process using a preload mechanism in order to reflect the processing result on the screen.
// main.js
const { app, BrowserWindow } = require('electron')
const path = require("path");
let win
function createWindow() {
win = new BrowserWindow({
width: 400,
height: 400,
webPreferences: {
nodeIntegration: true,
preload: path.join(__dirname, './src/preload.js'),
contextIsolation: true,
}
});
// ...
}
app.on('ready', () => {
createWindow();
})
// preload.js
const { contextBridge, ipcRenderer} = require("electron");
contextBridge.exposeInMainWorld(
"requires", {
nodessh : require('node-ssh'),
ipcRenderer : ipcRenderer,
}
);
// index.js(In RendererProcess)
const {NodeSSH} = window.requires.nodessh;
const ssh = new NodeSSH();
// ...
In this way, electron execution itself is possible, but on the second line of the index .js, an error of "Class constructor NodeSSH cannot be invoked without 'new'" occurs and the script stops executing.
When I checked in electron's developer console, the value of "window.requires.nodessh" seems to be "{SSHError: ƒ, NodeSSH: ƒ}", and I think the loading itself is successful, but is there any missing description?
Environment
Windows 11 Pro
Version 21H2 Build: 22000.613
npm -v
8.4.1
.\node_modules.bin\electron -v
v18.1.0
- 主要言語
- TypeScript
- スター
- 1k
- フォーク
- 94
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
steelbrain/node-ssh のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
steelbrain/node-ssh#487 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
steelbrain/node-ssh#482 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
steelbrain/node-ssh#474 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
steelbrain/node-ssh#473 · コメント 1 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
steelbrain/node-ssh#472 ·
steelbrain/node-ssh の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
cli: `execCargoMetadata` decodes stdout per chunk, corrupting non-ASCII paths across pipe boundariesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
lingdojo/kana-dojo#34127 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
osmlab/name-suggestion-index#13104 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100