I'm using node webkit with the node webkit hipster seed
I have build a native C++ module, using the Leap Motion SDK, which compile and work fine with node-gyp.
Now I'm trying to implement it on node webkit, but I always get "Error: no error" when I require my module. (Yes, it's recompiled with nw-gyp)
I was getting the same error when I was trying my module with node-gyp without leap sdk dlls, so I try to move my dlls in the module build directory, and in the application build directory, but no effect.
I'm using Windows 8, but I will also build on OSx
Strangely, it work by renamming the executable to nw.exe, thanks to https://github.com/geo8bit/nodebob/pull/7
Related
I recently began studying NodeJS using VSCode, and it turns out that Intellisense does recognize the methods of core Node modules (fs, http, os etc.), but not those belonging to an npm module which I installed by myself, using the npm install command (the pack: validator).
When chained with .default, however, Intellisense does accurately provide the methods belonging to the package.
Has anyone else encountered this issue when working with VSCode and NPM?
I am trying to upgrade my application from electron 1.8.1 to 4.0.6. I am using multiple native node js modules. They all compile successfully (or prebuilt binaries are available).
I am getting following error when requiring one of the modules.
XXXX\node_modules\electron-log\renderer.js:34 [10:14:51.109] Failed to add
module. Error: Error: The specified procedure could not be found.
\?\XXXXX\node_modules\pc-ble-driver-js\build\Release\pc-ble-driver-js-
sd_api_v2.node
Whereas other native modules (such as serialport, noble-uwp) are loading and working fine.
This error generally indicates that a required DLL is missing. I have used Dependency Walker (http://www.dependencywalker.com/) to check the dependencies but I couldn't nail down the error. I tried to compare dependencies for module that works and the one for which I get above error. I didn't see obvious differences.
I have Visual Studio 2015 installed. I also have VC++ 2015 redistributable installed.
My electron specific dependencies are:
"devDependencies": {
"electron": "~4.0.6",
"electron-builder": "~20.39.0",
"electron-rebuild": "^1.8.4"
},
I am using node-js 10.15.3.
I have noticed that till electron 3, node_modules/electron/dist had many DLLs present. These DLLs are not present with electron 4.
Are any additional dependencies needed to be installed for native modules to work with electron 4?
I got this to work.
For native node js modules to work with electron 4 on Windows, it needs to be compiled with "Delay Load Hook". More info: https://electronjs.org/docs/tutorial/using-native-node-modules#a-note-about-win_delay_load_hook and https://github.com/nodejs/node-addon-api/issues/269#issuecomment-455580129. After making these changes my failing module started to work.
About why other modules worked without these changes is because they use node-gyp directly. It takes care of using this hook.
My failing module uses cmake-js, which needs above mentioned additional changes.
I've created an electron application which uses two NodeJS native modules node ref and node ffi. The application is being developed on windows right now and the windows executable is generated with the help of electron-builder. This all works perfectly fine and the application is installed in windows properly. As both ffi and ref are native modules, I'm simply use electron-rebuild to rebuild them for platform win32 (I guess that internally uses node-gyp).
But the problem is, my CI/CD server is Ubuntu 16 and I need to generate the windows executable file there. If my application doesn't have node's native addons, it works fantastic but with native modules included, the exe file is generated but on launch it says %1 is not a win32 application and the reason for that is, the native deps are rebuilt for Linux platform instead of windows.
So I wanted to know is, is there any way to rebuild the node native modules on Linux machine for win32 platform or if its not possible then how can we use the pre-built .node file across the platforms.
I'm currently writing a node-webkit application which uses a native module (lwip). I found out that I need to compile native modules with nw-gyp.
After using nw-gyp a new file lwip_image.node will be created under node_modules/lwip/build/Release.
How is the native module required? Like this: var lwip_image = require('./node_modules/lwip/build/Release/lwip_image.node') ??
If the native module was created on Win8 x64, will it also work on Win7 x64 or even Win8/7 x32? Same question for Mac vs Ubuntu x32 vs Ubuntu x64?
To facilitate the build process I would build the native modules on the target platforms once. After that I would like to copy them all to my project dir so I can automate the build process to build it for all platforms at once. How would I go about that? Use os.platform() and require depending on platform? ...
UPDATE: Those posts were what I was looking for: https://github.com/joyent/node/issues/4398#issuecomment-11233144
https://github.com/npm/npm/issues/1891
Your module's short name will be used in "require"
Your 32-bit code (compiled with target=ia32) will work on 64-bit platform, but not the other way around
After you have compiled your module for all platforms, it should be enough to pack different zip, .app or .exe versions for different platforms, with different respective binaries of your module.
I'm using the latest node.js for Windows x86.
I tried to use the node-sharp package from github.
It does compile, but when I load it into the node.js process (via require('./Sharp')),
The rather strange error: Error: no error, cannot load the module C:\path\to\module\Sharp.node occurs.
Has anyone also tried to use this library?
Actually, a better alternative is Edge.js, it is more stable and works now both on Linux and Windows