[英]A file called pty.node.js is missing after installing "node-pty" in a electron-forge project. How can I install node-pty in Linux
After installing node-pty (an external module used to create pseudo terminals using node js) in a boilerplate electron-forge project;在样板电子锻造项目中安装 node-pty(用于使用 node js 创建伪终端的外部模块)之后; I found it throwing an error that some core module of node-pty is importing another module which nodejs is failing to find.
我发现它抛出了一个错误,即 node-pty 的某些核心模块正在导入另一个 nodejs 无法找到的模块。
After some research I discovered that entry point of node-pty is src/index.js
, which imports another module called src/unixTerminal.js
(this file is imported if the system is running on linux platform and my PC is running on Ubuntu 20.04) and that module tries to import build/Releases/pty.node.js
( unixTerminal.js
calls many functions imported from pty.node.js
, so this package cannot be ommitted) but as a matter of fact build/Releases/pty.node.js
is missing and completely absent in the node_modules/node-pty
folder of my project where I had installed node-pty
经过一番研究,我发现 node-pty 的入口点是
src/index.js
,它导入了另一个名为src/unixTerminal.js
的模块(如果系统运行在 linux 平台上并且我的 PC 运行在 Ubuntu 20.04 上,则导入此文件) and that module tries to import build/Releases/pty.node.js
( unixTerminal.js
calls many functions imported from pty.node.js
, so this package cannot be ommitted) but as a matter of fact build/Releases/pty.node.js
is missing and在我安装node-pty
的项目的node_modules/node-pty
文件夹中完全不存在
Why does this happen?为什么会这样? Is this any fault of myself in installing
node-pty
, I had installed it directly using npm i
command?这是我自己安装
node-pty
的错吗,我是直接使用npm i
命令安装的? If a vital file of a module is missing how can it work?如果一个模块的重要文件丢失,它如何工作? Please tell me how can I use
node-pty
on Linux and why build/Releases/pty.node.js
is missing in node-pty's directory?请告诉我如何在 Linux 上使用
node-pty
以及为什么 node-pty 的目录中缺少build/Releases/pty.node.js
?
Since you're using Electron Forge (a crucial detail omitted from the original post), according to this issue I found by googling "node-pty electron forge" you'll need to configure the Electron packager to unpack the pty.node
file:由于您使用的是 Electron Forge(原始帖子中省略了一个关键细节),因此根据我通过谷歌搜索“node-pty electron forge”发现的这个问题,您需要将
pty.node
包配置为
asar: {
unpack: '**/node_modules/node-pty/build/Release/*'
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.