2015-11-03 46 views
0

建築serialport.js我試圖打包serialport.jsnw.js應用。我很難建設serialport.jsnw.js與nw.gyp爲nw.js

我已經安裝了serialport.js「應用程序\資源\ node_modules」使用NPM。

我還安裝了nw.gyp全球「NPM安裝NW-GYP -g」

然後,我改變目錄「應用程序\資源\ node_modules \的SerialPort」其中結合.gyp位於並試圖重建與的serialport NW-GYP 「NW-GYP重建--target = 0.12.3」

這是我得到的錯誤: Undefin在binding.gyp

enter image description here

任何想法我怎麼能獲得通過這個問題編變量MODULE_NAME?

其他的似乎有類似的問題: Serialport.js in Node-webkit (nw.js) on Win 7

我也看到了一個不同的節點模塊發生了同樣的錯誤: Building node-sqlite3 with nw-gyp

回答

1

node_modules /的SerialPort/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": "." 

,並更改module_path中node_modules /的SerialPort /的package.json爲:

"module_path": "./build/{configuration}/", 

最後,運行NW-GYP重建 - 目標= 0.12.3