我的目标是安装13.4.0版和14.16.0版Node的电子产品。然而,当我在我的文件上运行electron-rebuild时,它为NODE_MODULE_VERSION构建83 (由节点14使用),而不是所需的89 (由电子使用)。以下是一些相关文件:
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-rebuildpackage.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"
}我应该如何修复这个问题,以便能够根据模块版本89正确地构建我的模块?
发布于 2021-11-25 21:54:04
事实证明,我的C++文件中的#include语句包含了系统的节点库,而不是电子的特定节点库。
我改变了这一点:
#include<node/node.h>要这样做:
#include<node.h>https://stackoverflow.com/questions/70105948
复制相似问题