Questions tagged [node-native-addon]
22 questions
6
votes
1 answer
Node-ffi: Loading a C++ dll(with external dependencies) in js is getting crashed
Iam trying to load a c++ dll in JS using node-ffi. When the dll does not have any external dependencies, it works fine as expected. But it crashes, when it has any external dependencies.
const ffi = require("@saleae/ffi");
const MyDll = new…

Vignesh
- 61
- 1
3
votes
1 answer
How do I load my own native node modules in my Electron app?
I built a C++ native module called foo for my Electron app. The module is located in my project root directory. I added the project to my package.json by setting a local path - a feature that is supported and described here.
"dependencies": {
…

HelloWorld
- 2,392
- 3
- 31
- 68
3
votes
0 answers
Node.js native modules build cache
Our project is quite big and compiling native addon dependencies on npm ci or clean npm install takes several minutes.
Is there any way to cache and re-use the built native addons except of saving node_modules as a whole?

Konstantin Pelepelin
- 1,303
- 1
- 14
- 29
2
votes
0 answers
Electron Crash on calling a native addon which is using window's uiautomation library to detect button in another window
I have a native addon which detect zoom meeting window and find some button in it.
That Native addon is made using NAPI(node-addon-api) and when I run it, it works fine...(give me that button name).
But when I try to run that native addon in…

AtiqGauri
- 1,483
- 13
- 26
2
votes
0 answers
Handling version incompatibility in npm dependencies
Some context
Every time VS Code is released built on a new version of Node, the VS Code Arduino extension breaks until a new version is released.
Having cloned the Arduino extension git repo I uninstalled it as an extension and ran it in the…

Peter Wone
- 17,965
- 12
- 82
- 134
2
votes
1 answer
How to create an OpenGL context on an NodeJS native addon on MacOS?
Follow-up for this question.
I'm trying to create a NodeJS native addon that uses OpenGL.
I'm not able to use OpenGL functions because CGLGetCurrentContext() always returns NULL.
When trying to create a new context to draw into, CGLChoosePixelFormat…

GBF_Gabriel
- 2,636
- 2
- 17
- 15
1
vote
0 answers
Use existing C Code as Native Add-on in Node.js
I have never dealed with C or C++ before, so please be gentile with me :) I want to use this C Code from this Repo as a Node Module:
https://github.com/torvalds/pesconvert
I read that this can be done with Node.Js Native Addons, but all Examples I…

iking1211
- 21
- 3
1
vote
0 answers
Interface for Native Module in Electron-TypeScript-React App
I'm writing an app that depends on a native Node module using Electron, React and TypeScript. I have context isolation on and am using a preload script to expose the API of the native module onto the global scope. My preload script looks like:
const…

Shane Murphy
- 53
- 4
1
vote
0 answers
NAPI: How to match a JS regex from a C++ thread?
I am modifying a Node native extension that is spawning native threads to do some processing. My issue is that I'd like to have the Javascript code provide a filter for the processing to exclude some data.
At this point, I'm passing a JS RegExp…

WKnight02
- 182
- 1
- 11
1
vote
1 answer
Print node terminal/main.js log to renderer console (developer tools)
I have a electron app which is using c++ native addon in it.
C++ code prints log to terminal and while development I can see them in termianl.
Electron app log in renderer.js console (developer tools console).
The same thing does not happen after…

AtiqGauri
- 1,483
- 13
- 26
1
vote
1 answer
How do I update a Node.js native addon to use the new API?
There's an old Node.js native addon that I need for my work, but no longer works for Node.js 12 and above because of deprecation of many native APIs. Out of dozens of errors, I have fixed all but one, which has to do with initializing and calling a…

Ermir
- 1,391
- 11
- 25
1
vote
1 answer
How to check a napi_value of type napi_number is an integer or decimal by using node.js N-API function,
How to check a given napi_value of type napi_number is an integer or decimal (a number with fractional value) by using node.js native N-API function .
Look like there is no isInt() or isDouble() equivalent function in N-API (we don’t want to use V8…

Satyan
- 1,346
- 8
- 15
0
votes
0 answers
Not able to dynamically install prebuilt native-addon as npm dependency based on process.platform and architecture
I'm developing npm package (my_package) that is using domain-specific C/C++ libraries (c-library) via Node-API. Such setup has a reason, because this C/C++ library is being well maintained and rewriting it in JS/TS would not be feasible.
The problem…

Serg
- 1
- 1
0
votes
0 answers
How to share c++ data from multiple worker-thread loaded node addons
The title may be a little confusing. What I wanna do is that I have a shared value, which need to be shared as part of node native addon. The addon itself is context aware, which means it may be loaded from many worker threads. So my question is how…

branson
- 55
- 4
0
votes
1 answer
Using CMake generator expressions with GYP
I'm working on Node.js native module which contains C and C++ sources. node-gyp is used to build the module.
As I want only one warning rises error in C code I use the following lines in binding.gyp:
"cflags!": [ "-Werror"],
"cflags": […

Serg
- 2,346
- 3
- 29
- 38