首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用nw.gyp for nw.js构建nw.js

用nw.gyp for nw.js构建nw.js
EN

Stack Overflow用户
提问于 2015-11-03 18:56:22
回答 2查看 903关注 0票数 1

我正在尝试将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

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-11-12 14:20:42

打开节点_模块/序列化端口/binding.gyp,您需要做一些更改..。

以前:

代码语言:javascript
复制
  "target_name": "action_after_build",
  "type": "none",
  "dependencies": [ "<(module_name)" ],
  "copies": [
    {
      "files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
      "destination": "<(module_path)"

后:

代码语言:javascript
复制
  "target_name": "action_after_build",
  "type": "none",
  "dependencies": [ "serialport" ],
  "copies": [
    {
      "files": [ "<(PRODUCT_DIR)/serialport.node" ],
      "destination": "."

并在node_modules/序列化端口/Package.json中更改module_path,以便:

代码语言:javascript
复制
"module_path": "./build/{configuration}/",

最后,运行nw-gyp重建--target=0.12.3

票数 1
EN

Stack Overflow用户

发布于 2021-04-01 15:44:36

降级npm工作!试着

npm安装npm@6 -g

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33506946

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档