我的操作系统是windows。我想使用 xterm 和 node-pty 创建一个 bash shell。有这行代码:
this.shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
使用它在浏览器中呈现终端。现在假设如果我写:
this.shell = os.platform() === 'win32' ? 'bash' : 'powershell.exe';
或者
this.shell = os.platform() === 'linux' ? 'powershell.exe' : 'bash';
为什么不渲染 bash shell。它给了我这个错误:
D:\DE_proj\linuxterminal\server\node_modules\node-pty\lib\windowsPtyAgent.js:75
term = this._ptyNative.startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor);
^
Error: File not found:
at new WindowsPtyAgent (D:\DE_proj\linuxterminal\server\node_modules\node-pty\lib\windowsPtyAgent.js:75:36)
at new WindowsTerminal (D:\DE_proj\linuxterminal\server\node_modules\node-pty\lib\windowsTerminal.js:50:24)
at Object.spawn (D:\DE_proj\linuxterminal\server\node_modules\node-pty\lib\index.js:28:12)
at PTY.startPtyProcess (D:\DE_proj\linuxterminal\server\PTYService.js:16:27)
at new PTY (D:\DE_proj\linuxterminal\server\PTYService.js:11:10)
at Namespace.<anonymous> (D:\DE_proj\linuxterminal\server\SocketService.js:40:18)
at Namespace.emit (events.js:315:20)
at Namespace.emitReserved (D:\DE_proj\linuxterminal\server\node_modules\socket.io\dist\typed-events.js:56:22)
at D:\DE_proj\linuxterminal\server\node_modules\socket.io\dist\namespace.js:140:26
at processTicksAndRejections (internal/process/task_queues.js:75:11)
[nodemon] app crashed - waiting for file changes before starting...
对不起,我对这个问题很陌生......