- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下 project与 Electron 。有以下./src/index.js
(我的应用程序在哪里启动):
const { app, BrowserWindow, ipcMain } = require('electron');
const nbind = require('nbind');
const lib = nbind.init().lib;
const myPromice= new lib.MyPromice();
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;
const createWindow = () => {
// Create the browser window.
mainWindow = new BrowserWindow();
mainWindow.setMenu(null);
mainWindow.maximize();
// and load the index.html of the app.
mainWindow.loadURL(`file://${__dirname}/ui/index.html`);
mainWindow.on('closed', () => {
mainWindow = null;
});
MyPromice.exec();
};
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', () => {
app.quit();
});
app.on('activate', () => {
createWindow();
});
package.json
是:
{
"name": "electron-cpp-bindings",
"version": "1.0.0",
"description": "A simple test using C++ bindings on an electron app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron ./src/",
"autogypi": "autogypi",
"node-gyp": "HOME=~/.electron-gyp node-gyp --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers",
"emcc-path": "emcc-path",
"copyasm": "copyasm",
"ndts": "ndts",
"electron-version": "electron -v",
"rebuild": "HOME=~/.electron-gyp electron-rebuild --version=70 --module-dir build"
},
"author": "Dimitrios Desyllas",
"license": "MIT",
"devDependencies": {
"electron": "^5.0.8",
"electron-rebuild": "^1.8.5"
},
"dependencies": {
"autogypi": "^0.2.2",
"nbind": "^0.3.15",
"node-gyp": "^5.0.3"
}
}
src/cpp/promice.h
:
#ifndef PROMICE
#define PROMICE
class MyPromice {
public:
MyPromice(){};
~MyPromice(){};
void exec();
};
#endif
src/cpp/promice.cpp
#include"promice.h"
#include <iostream>
#include <thread>
#include <chrono>
void MyPromice::exec(){
std::this_thread::sleep_for(std::chrono::milliseconds(200));
std::cout << "Executing Code" << std::endl;
}
#include "nbind/nbind.h"
NBIND_CLASS(MyPromice) {
method(exec);
}
# Electron's version.
export npm_config_target=1.2.3
# The architecture of Electron, see https://electronjs.org/docs/tutorial/support#supported-platforms
# for supported architectures.
export npm_config_arch=x64
export npm_config_target_arch=x64
# Download headers for Electron.
export npm_config_disturl=https://electronjs.org/headers
# Tell node-pre-gyp that we are building for Electron.
export npm_config_runtime=electron
# Tell node-pre-gyp to build module from source code.
export npm_config_build_from_source=true
# Install all dependencies, and store cache to ~/.electron-gyp.
HOME=~/.electron-gyp npm install
./node_modules/.bin/electron-rebuild
✔ Rebuild Complete
npm run -- node-gyp \
configure build
> configure build
> electron-cpp-bindings@1.0.0 node-gyp /home/pc_magas/Kwdikas/Javascript/electron-cpp-bindings
> HOME=~/.electron-gyp node-gyp --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers "configure" "build"
make: Entering directory '/home/pc_magas/Kwdikas/Javascript/electron-cpp-bindings/build'
COPY Release/obj.target/nbind/geni/symbols.txt
CXX(target) Release/obj.target/nbind/src/cpp/promice.o
CXX(target) Release/obj.target/nbind/node_modules/nbind/src/common.o
CXX(target) Release/obj.target/nbind/node_modules/nbind/src/reflect.o
CXX(target) Release/obj.target/nbind/node_modules/nbind/src/v8/Buffer.o
CXX(target) Release/obj.target/nbind/node_modules/nbind/src/v8/Binding.o
SOLINK_MODULE(target) Release/obj.target/nbind.node
COPY Release/nbind.node
make: Leaving directory '/home/pc_magas/Kwdikas/Javascript/electron-cpp-bindings/build'
npm start
启动我的应用程序时我收到以下错误:
> electron-cpp-bindings@1.0.0 start /home/pc_magas/Kwdikas/Javascript/electron-cpp-bindings
> electron ./src/
App threw an error during load
Error: The module '/home/pc_magas/Kwdikas/Javascript/electron-cpp-bindings/build/Release/nbind.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 70. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at process.func [as dlopen] (electron/js2c/asar.js:155:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:881:18)
at Object.func [as .node] (electron/js2c/asar.js:155:31)
at Module.load (internal/modules/cjs/loader.js:701:32)
at tryModuleLoad (internal/modules/cjs/loader.js:633:12)
at Function.Module._load (internal/modules/cjs/loader.js:625:3)
at Module.require (internal/modules/cjs/loader.js:739:19)
at require (internal/modules/cjs/helpers.js:14:16)
at initNode (/home/pc_magas/Kwdikas/Javascript/electron-cpp-bindings/node_modules/nbind/dist/nbind.js:141:15)
at /home/pc_magas/Kwdikas/Javascript/electron-cpp-bindings/node_modules/nbind/dist/nbind.js:115:13
A JavaScript error occurred in the main process
Uncaught Exception:
Error: The module '/home/pc_magas/Kwdikas/Javascript/electron-cpp-bindings/build/Release/nbind.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 70. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at process.func [as dlopen] (electron/js2c/asar.js:155:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:881:18)
at Object.func [as .node] (electron/js2c/asar.js:155:31)
at Module.load (internal/modules/cjs/loader.js:701:32)
at tryModuleLoad (internal/modules/cjs/loader.js:633:12)
at Function.Module._load (internal/modules/cjs/loader.js:625:3)
at Module.require (internal/modules/cjs/loader.js:739:19)
at require (internal/modules/cjs/helpers.js:14:16)
at initNode (/home/pc_magas/Kwdikas/Javascript/electron-cpp-bindings/node_modules/nbind/dist/nbind.js:141:15)
at /home/pc_magas/Kwdikas/Javascript/electron-cpp-bindings/node_modules/nbind/dist/nbind.js:115:13
rm -rf ./node_mobules
npm install
最佳答案
我遇到过同样的问题。在尝试了许多版本的代码后,我发现了这个:
node-gyp configure build
npm run rebuild
关于javascript - 使用 `NODE_MODULE_VERSION 70.` 而不是 NODE_MODULE_VERSION 48 重建 nbind,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57316922/
如果我使用 alter index x rebuild 重建不可用的索引,是否会重新评估之前使用该索引的任何 SQL 的执行计划? 我知道在我使用的数据库版本 - Oracle 10.2.0.4.0
我正在研究 3d 重建。现在当我考虑一对图像时。我有一组对应点。我有我的相机详细信息。例如我有焦点细节,旋转和平移矩阵(4 * 4)。我想在 3D(三角剖分)中投影我的点。因此,据我所知,因子代数非常
从教程中:https://programtalk.com/vs2/?source=python/8176/opencv-python-blueprints/chapter4/scene3D.py 我不
我需要您的帮助和建议。这个问题包括以下几项:某房间的照片,该房间站在严格固定位置的房间内(一个房间围绕轴线旋转)。如何将所有这些图片组合在一起,从而产生一种效果,就像我们用眼睛看到的一样?从一点开始就
嘿那里,以下问题:我在工作中使用一个相当奇怪的 Linux 发行版(Centos 5),它似乎有一个较旧的内核(或者至少在内核中存在一些差异),并且您不能简单地更新它。我需要安装的程序需要一个函数 c
我读了一些关于受限玻尔兹曼机的文章。这些机器的重建能力经过了测试。我了解训练是如何进行的,但不了解重建是如何完成的。有人可以给我一些提示吗? 最佳答案 杰夫·辛顿 (Geoff Hinton) 的演讲
如果轻量级迁移失败,我将尝试重建核心数据数据堆栈,并将用户送回登录屏幕。我正在通过将一对多关系更改为一对一关系来对此进行测试。 起初,我在删除新的 persistentStoreCoordinator
以下所列示例中中 `table_name` 表示数据表名,`index_name` 表示索引名,column list 表示字段列表(如:`id`,`order_id`)。 1、创建索引 索引的
当您根据 ListView.builder 和 ListView.separated valueKey = key; return _messages
切换底部导航页面后,我有一个非常烦人的谷歌地图 flutter 重建问题。我已经坚持了最后一次缩放和相机位置,但是每次我进入 map 页面时,小部件都会自行重建。如何预防? 最佳答案 采用 Autom
我是 Python 的新手。我在重建一个错误的 Dataframe 时遇到了麻烦。我的数据框如下所示: df = pd.DataFrame({'col1': ['id 1', 'id 2', 'tes
我正在尝试从 2 个图像中实现 3d 重建。我遵循的步骤是, 1. Found corresponding points between 2 images using SURF. 2. Impleme
// Start with this JSON var initialJson = { "rows": [{ "ID": 123, "Data": 430910, "Ver
在有状态的小部件中,我有一个导航部分,用户可以在其中选择父项,并在子项下方显示。 当我选择父级也可以重建子部件时,但是当我导航抛出父项而不选择一个子部件时,父级也可以重建(这是正常的),但是子部件也可
我有一个网络摄像头,它可以围绕人的头部以给定的角度步长旋转,并为每一步获取一张图片。 我正在寻找一个免费的开源库,该库从获取的图像集开始,使我能够生成代表人头部的 3D 表面,或者至少是定义明确的 3
我想从一行中读取一个字符串,然后将其放入一个变量中,该变量随后用作文件名。该字符串位于 .csv 文件中的第二行末尾。由于不必要的标题,需要删除第一行。还有‘;’旧 .csv 文件中使用的内容需要替换
我正在使用file-embed如此封装: import qualified Data.ByteString as B import qualified Data.ByteString.Internal
我的 makefile 总是重建,不明白为什么.. 这里是: SRC = $(DIR)/my_getnbr.c \ $(DIR)/my_isneg.c \ $(DI
我有一个附带编辑器的 Eclipse 插件。 我添加了更改语法突出显示颜色的首选项,但这些更改仅在我手动重新启动编辑器后才适用。 我通过一个 DefaultDamagerRepairer 实现了语法高
我有一段 php 可以输出 div(取决于数组中有多少个)并为该 div 分配一个 id(即 div_1、div_2)等 我还设置了一个隐藏字段,其中包含输出了多少个 div 的计数(divcount
我是一名优秀的程序员,十分优秀!