Can't find module '../build/Debug/pty.node' by electron-rebuild rebuild
Pulset opened this issue · 4 comments
Pulset commented
Environment details
- OS:Mac os
- OS version:11.4
- node-pty version:0.10.1
- electron version: 19.0.9
- node version: 16.16.0
- electron-rebuild: 3.2.8
Issue description
I rebuild the this module for Electron with the electron-rebuild package,it rebuilds successful.But when I run this project, I get some errors.
innerError Error: Cannot find module '../build/Debug/pty.node'
Require stack:
- /Users/zcy/Desktop/project/dunHuang/leo-gui/app/node_modules/node-pty/lib/unixTerminal.js
- /Users/zcy/Desktop/project/dunHuang/leo-gui/app/node_modules/node-pty/lib/index.js
- /Users/zcy/Desktop/project/dunHuang/leo-gui/app/main/util/tool.js
- /Users/zcy/Desktop/project/dunHuang/leo-gui/app/main/util/inject.js
at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
at i._resolveFilename (node:electron/js2c/renderer_init:33:1095)
at Module._load (node:internal/modules/cjs/loader:785:27)
at c._load (node:electron/js2c/asar_bundle:5:13343)
at i._load (node:electron/js2c/renderer_init:33:356)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/zcy/Desktop/project/dunHuang/leo-gui/app/node_modules/node-pty/lib/unixTerminal.js:30:15)
at Object.<anonymous> (/Users/zcy/Desktop/project/dunHuang/leo-gui/app/node_modules/node-pty/lib/unixTerminal.js:278:3)
at Module._compile (node:internal/modules/cjs/loader:1118:14)
(anonymous) @ /Users/zcy/Desktop/project/dunHuang/leo-gui/app/node_modules/node-pty/lib/unixTerminal.js:33
node:electron/js2c/renderer_init:73 Error: node-pty failed to load. Typically this means that it was built incorrectly. Please check the readme.md to more info. Error: Loading non-context-aware native module in renderer: '/Users/zcy/Desktop/project/dunHuang/leo-gui/app/node_modules/node-pty/build/Release/pty.node'. See https://github.com/electron/electron/issues/18397.
at exports.throwNodePtyError (/Users/zcy/Desktop/project/dunHuang/leo-gui/app/main/services/sessions/error.js:4:40)
at Object.<anonymous> (/Users/zcy/Desktop/project/dunHuang/leo-gui/app/main/util/tool.js:13:19)
at Object.<anonymous> (/Users/zcy/Desktop/project/dunHuang/leo-gui/app/main/util/tool.js:165:3)
at Module._compile (node:internal/modules/cjs/loader:1118:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:829:12)
at c._load (node:electron/js2c/asar_bundle:5:13343)
at i._load (node:electron/js2c/renderer_init:33:356)
at Module.require (node:internal/modules/cjs/loader:1012:19)
(anonymous) @ node:electron/js2c/renderer_init:73
I see the code.It exists this file,but throw a error.
anupvarma commented
+1
DhlDeliveryMan commented
Happens to me too on linux ubuntu 20.04, have you possibly found a solution ?
Pulset commented
Happens to me too on linux ubuntu 20.04, have you possibly found a solution ?
I find when electron startup,I require or import node-pty it's throw error.But I require node-pty in the function when I call,it's ok.
Tyriar commented
This means node-pty failed to install correctly, try re-installing via npm/yarn and check if there are errors.