gpt4 book ai didi

node.js - 错误 : Could not locate the bindings file. 已尝试:

转载 作者:搜寻专家 更新时间:2023-10-31 22:47:16 24 4
gpt4 key购买 nike

我在尝试运行包含我的 Express 应用程序的 Electron 应用程序时遇到了以下错误。

Error: Could not locate the bindings file. Tried:

我认为问题与 serialport 模块有关,因为不需要它一切正常。

C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\bindings\bindings.js:91

<br>Error: Could not locate the bindings file. Tried:
<br> → C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\serialport\build\serialport.node
<br> → C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\serialport\build\Debug\serialport.node
<br> → C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\serialport\build\Release\serialport.node
<br> → C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\serialport\out\Debug\serialport.node
<br> → C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\serialport\Debug\serialport.node
<br> → C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\serialport\out\Release\serialport.node
<br> → C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\serialport\Release\serialport.node
<br> → C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\serialport\build\default\serialport.node
<br> → C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\serialport\compiled\6.3.1\win32\ia32\serialport.node
<br> at bindings (C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\bindings\bindings.js:88:9)
<br> at Object.<anonymous> (C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\serialport\lib\bindings.js:3:35)
<br></anonymous> at Module._compile (module.js:541:32)
<br> at Object.Module._extensions..js (module.js:550:10)
<br> at Module.load (module.js:458:32)
<br> at tryModuleLoad (module.js:417:12)
<br> at Function.Module._load (module.js:409:3)
<br> at Module.require (module.js:468:17)
<br> at require (internal/module.js:20:19)
<br> at Object.<anonymous> (C:\Users\Jonathan\Desktop\client\<NAME>\electron-with-express\express-app\node_modules\serialport\lib\serialport.js:15:25)

最佳答案

您需要重建串口模块,因为它使用与 Electron 不同的 V8 头文件。

首先您需要设置一个 node-gyp 工具链 ( https://github.com/nodejs/node-gyp )

接下来,安装任意版本的 Visual Studio。

打开命令窗口并将目录更改为项目中的 node_modules/serialport。

使用适当的变量输入此命令:

node-gyp rebuild --target=<electron_version> --arch=<arch> --dist-url="https://atom.io/download/atom-shell" --msvs_version=<visual_studio_year>

例如,这是我在重建时使用的命令:

node-gyp rebuild --target=1.2.5 --arch=x64 --dist-url="https://atom.io/download/atom-shell" --msvs_version=2013

关于node.js - 错误 : Could not locate the bindings file. 已尝试:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39002144/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com