我正在尝试将serialport.js与我的nw.js应用程序一起打包。我很难为serialport.js nw.js。
我已经使用npm在我的"app\resource\node_modules"中安装了serialport.js。
我还安装了nw.gyp "npm install nw-gyp -g"。
然后,我将目录更改为"app\resource\node_modules\serialport" ( binding.gyp所在的目录),并尝试使用nw-gyp "nw-gyp重新构建--target=0.12.3"重新构建序列化端口。
这是我得到的错误:未定义变量module_name in binding.gyp

有什么办法能让我通过这个问题吗?
其他人似乎也有类似的问题:Serialport.js in Node-webkit (nw.js) on Win 7
我还看到了相同的错误发生在不同的节点模块:Building node-sqlite3 with nw-gyp。
发布于 2015-11-12 14:20:42
打开节点_模块/序列化端口/binding.gyp,您需要做一些更改..。
以前:
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "<(module_name)" ],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
"destination": "<(module_path)"后:
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "serialport" ],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/serialport.node" ],
"destination": "."并在node_modules/序列化端口/Package.json中更改module_path,以便:
"module_path": "./build/{configuration}/",最后,运行nw-gyp重建--target=0.12.3
发布于 2021-04-01 15:44:36
降级npm工作!试着
npm安装npm@6 -g
https://stackoverflow.com/questions/33506946
复制相似问题