Reputation: 405
I'm trying to target an electron installation with version 13.4.0 and Node version v14.16.0. However, when I run electron-rebuild
on my file it builds for NODE_MODULE_VERSION
for 83 (used by Node 14) and not the required 89 (used by electron). Here are some relevant files:
binding.gyp
:
{
"targets": [
{
"target_name": "tuxphones",
"sources": ["main.cpp"],
"cflags_cc": [
"-std=c++17"
],
"libraries": [
"-lopus",
"-lpulse"
]
}
]
}
Dockerfile
:
FROM node:14-buster-slim
RUN apt-get update
RUN apt-get install -y python3 make libpulse-dev libopus-dev g++
RUN mkdir /build
WORKDIR /build
COPY package.json /build/
RUN npm install
COPY ./native/ /build/
RUN ./node_modules/.bin/electron-rebuild
package.json
:
{
"name": "tuxphones",
"version": "1.0.0",
"description": "",
"main": "Tuxphones.plugin.js",
"scripts": {
"rebuild": "electron-rebuild -f",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"electron": "^13.4.0",
"electron-rebuild": "^3.2.5"
},
"author": "ImTheSquid",
"license": "MIT"
}
How should I fix this so that I can build my module correctly against module version 89?
Upvotes: 0
Views: 581
Reputation: 405
Turns out the #include
statement in my C++ file was including the system's Node library over the specific one for Electron.
I changed this:
#include<node/node.h>
To this:
#include<node.h>
Upvotes: 0