microsoft / node-pty

Fork pseudoterminals in Node.JS
Other
1.43k stars 232 forks source link

Cannot find module '../build/Debug/conpty.node' #544

Closed kachbit closed 2 years ago

kachbit commented 2 years ago

Environment details

Issue description

Package installs successfully. However, when electron window loads, the terminal does not display, and the console shows two errors: innerError Error: Cannot find module '../build/Debug/conpty.node' and

Uncaught Error: The module '...\node-pty\build\Release\conpty.node'
was compiled against a different Node.js version using NODE_MODULE_VERSION 93. This version of Node.js requires NODE_MODULE_VERSION 80. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`).
Tyriar commented 2 years ago

This means you compiled node-pty against your system's node version, not electron's. See https://github.com/microsoft/node-pty/blob/main/examples/electron/npm_install.sh for an example of how to do this properly.

kachbit commented 2 years ago

Executing the .sh file still does not fix the problem :/

Tyriar commented 2 years ago

@kachbit it's an example of how it's done in the electron example, you need to learn how compile the node module using electron's version of node. This is not a problem with node-pty but your build setup.

kachbit commented 2 years ago

@Tyriar Okay, I think I have it figured out. I need to download the correct node version that supports Node Module Version 80. I looked through this (page 11) to try to find the correct release, however, it does not contain a release with Node Module Version 80! Only 79 and 83. Sorry if this is annoying, but I'm stumped.

Tyriar commented 2 years ago

Here's the electron doc page on it http://man.hubwiz.com/docset/electron.docset/Contents/Resources/Documents/docs/tutorial/using-native-node-modules.html