Native modules built by node-gyp/npm is now supported

2,779 views
Skip to first unread message

Kevin Fan

unread,
Feb 11, 2016, 3:32:39 AM2/11/16
to nwjs-g...@googlegroups.com
Hello,

As we're working on NW13 we found that native modules built by node-gyp
or npm in upstream can be supported. It benefits from changes in nw13 as
well as the delay load hook in upstream.

In Linux and OSX you can just load the native module directly. In
windows you'll need to replace the file
%APPDATA%\npm\node_modules\node-gyp\src\win_delay_load_hook.c with the
one at
https://github.com/nwjs/nw.js/blob/nw13/tools/win_delay_load_hook.c

The change is tested with 0.13.0-beta5 and the example module in Nan
project.
--
Kevin Fan, NW.js maintainer

Kevin Fan

unread,
Feb 11, 2016, 3:38:51 AM2/11/16
to nwjs-g...@googlegroups.com
Native module support in NW.js has been done by nw-gyp. It doesn't
support handling dependencies between native modules automatically. With
this change nw-gyp is not needed any more.
> --
> You received this message because you are subscribed to the Google Groups
> "nw.js" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nwjs-general...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

sign...@gmail.com

unread,
Feb 20, 2016, 2:06:40 PM2/20/16
to nw.js, ke...@nwjs.io
Hello,
  I'm using node-o...@1.6.0,npm install and build it with nod...@5.6.0.
  It's ok in nodejs ENV,but failed in nwjs.
>require('oracledb');
Uncaught Error: A dynamic link library (DLL) initialization routine failed.
\orcalTest\node_modules\oracledb\build\Release\oracledb.node


在 2016年2月11日星期四 UTC-8上午12:32:39,Kevin Fan写道:

Roger Wang

unread,
Feb 20, 2016, 7:43:27 PM2/20/16
to nw.js, ke...@nwjs.io, sign...@gmail.com
Thanks for reporting. Will check this. Please submit an issue in github: https://github.com/nwjs/nw.js/issues/new

sign...@gmail.com

unread,
Feb 21, 2016, 1:25:58 AM2/21/16
to nw.js, ke...@nwjs.io, sign...@gmail.com
OK,Here it is https://github.com/nwjs/nw.js/issues/4426

在 2016年2月21日星期日 UTC+8上午8:43:27,Roger Wang写道:

giova...@gmail.com

unread,
Mar 18, 2016, 10:22:40 AM3/18/16
to nw.js, ke...@nwjs.io


I am triyin to compile node serialport plugin. when i run

npm install -s serialport 

Uncaught Error: Cannot find module 'D:\Proyectos\software cnc\cnc\node_modules\serialport\build\Release\node-webkit-v0.13.0-rc1-win32-x64\serialport.node'

then i go to the serialport module folder and run

node-gyp rebuild
 
gyp info it worked if it ends with ok
gyp info using node...@3.3.1
gyp info using no...@5.6.0 | win32 | x64
gyp info spawn C:\tools\python2\python.EXE
gyp info spawn args [ 'C:\\Users\\Gio\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\Proyectos\\software cnc\\cnc\\node_modules\\serialport\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Gio\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Gio\\.node-gyp\\5.6.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Gio\\.node-gyp\\5.6.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Gio\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\Proyectos\\software cnc\\cnc\\node_modules\\serialport',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'D:\\Proyectos\\software cnc\\cnc\\node_modules\\serialport\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\Gio\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Gio\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Proyectos\software cnc\cnc\node_modules\serialport
gyp ERR! node -v v5.6.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok

marti...@gmail.com

unread,
Mar 24, 2016, 4:38:03 AM3/24/16
to nw.js, ke...@nwjs.io
Wouldn't int be easier to include this as a special command in nw.js? I can imagine forgetting about this post in the future and thus mixing it up.
And quick question: will this make it into normal node-gyp in the future? Seems that this would also be beneficial in other applications as well. If there is a topic about that, please link it so we can upvote it.

Op donderdag 11 februari 2016 09:32:39 UTC+1 schreef Kevin Fan:

Jean-Philippe Côté

unread,
Mar 24, 2016, 1:06:30 PM3/24/16
to nw.js, ke...@nwjs.io, giova...@gmail.com
I am triyin to compile node serialport plugin. when i run

I have a suggestion for you. If you are using NW.js v0.13, it would be much easier to use the built-in chrome.serial API instead of node-serialport.

bec...@gmail.com

unread,
Mar 25, 2016, 3:41:41 AM3/25/16
to nw.js, ke...@nwjs.io
"sqlite3" module  in not working in nwjs.
    
 


  "serialport " module  in not working also. same error


i did replace "win_delay_load_hook.c " file 

giova...@gmail.com

unread,
Mar 25, 2016, 11:21:08 AM3/25/16
to nw.js, ke...@nwjs.io, bec...@gmail.com

have you try compile with these options?

node-pre-gyp rebuild --runtime=node-webkit --target=0.13.0-beta7 --target_arch=x64

bec...@gmail.com

unread,
Jun 23, 2016, 6:05:55 PM6/23/16
to nw.js, ke...@nwjs.io, bec...@gmail.com, giova...@gmail.com
Dear Kevin, 
node-pre-gyp rebuild --runtime=node-webkit --target=0.13.0-beta7 --target_arch=x64​ 
Is Not work either, IT Give flowing error,
0296f30481564bfeaf1018d0d0a64c4f.png (1655×621)

Brother i really new sqlite3 module for my nwjs project. 
Can you pls provide me prebuilt sqlite3 module for nwjs.
here is my platform details,

NWJS version : 0.15.3(target=0.15.3)
OS : Windows 64 BIT (target_arch=x64​ )

It will help me a lot. 
Waiting for your replay 

Thanks
Fazly Rabbi


cong...@gmail.com

unread,
Jun 24, 2016, 1:13:05 AM6/24/16
to nw.js, ke...@nwjs.io, bec...@gmail.com, giova...@gmail.com
First of all, --target should be the nw version you are using ( i.e. 0.15.3 in this case).
Second, you have to install node-gyp with npm.

- Cong

在 2016年6月24日星期五 UTC+8上午6:05:55,bec...@gmail.com写道:

Roger Wang

unread,
Jul 7, 2016, 9:16:20 PM7/7/16
to nw.js, ke...@nwjs.io
In 0.15.x. this is broken due to v8 API change. rebuilding with nw-gyp is still needed due to v8 API change. See https://github.com/nwjs/nw.js/issues/5025
Reply all
Reply to author
Forward
0 new messages