Электрон и Бигнум пакет неопределенный символ BN_new - PullRequest
0 голосов
/ 22 января 2019

Я пытаюсь использовать пакет bignum для моего электронного проекта из этого кода:

const { app, BrowserWindow, ipcMain } = require('electron');
const bignum = require('bignum');

// 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 bignumValue = bignum("FFA122310DC", 16);


const createWindow = () => {
  // Create the browser window.
  mainWindow = new BrowserWindow({
      globals:{
          num: bignumValue.toString()
      }
  });
  mainWindow.setMenu(null);
  mainWindow.maximize();


  // and load the index.html of the app.
  mainWindow.loadURL(`file://${__dirname}/index.html`);

  mainWindow.on('closed', () => {
    mainWindow = null;
  });
};

// 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);

app.on('before-quit', () => {
  if (xmpp) {
    xmpp.disconnect();
  }
});

// Quit when all windows are closed.
app.on('window-all-closed', () => {
  // On OS X it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform !== 'darwin') {
    app.quit();
  }
});

app.on('activate', () => {
  // On OS X it's common to re-create a window in the app when the
  // dock icon is clicked and there are no other windows open.
  if (mainWindow === null) {
    createWindow();
  }
});

process.on('unhandledRejection', (reason, p) => {
  console.error('Possibly Unhandled Rejection at: Promise ', p, ' reason: ', reason);
});

process.on('SIGINT', () => {
  if (xmpp) {
    xmpp.disconnect();
  }
  process.exit(0);
});

Но приведенный выше код выдает следующую ошибку:

> dummy_electron@1.0.0 start /home/pcmagas/Kwdikas/master_thesis/dummy_electron
> NODE_ENV=dev electron main.js

/home/pcmagas/Kwdikas/master_thesis/dummy_electron/node_modules/electron/dist/electron main.js: symbol lookup error: /home/pcmagas/Kwdikas/master_thesis/dummy_electron/node_modules/bignum/build/Release/bignum.node: undefined symbol: BN_new
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! dummy_electron@1.0.0 start: `NODE_ENV=dev electron main.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the dummy_electron@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pcmagas/.npm/_logs/2019-01-22T13_48_13_262Z-debug.log

По какой-то причине библиотека не может соединиться с библиотекой openssl.

Библиотека была установлена ​​так:

npm install --save bignum
./node_modules/.bin/relectron-rebuild

И я попытался восстановить его так:

electron-rebuild --openssl-root="/usr/bin/openssl" --arch=x64

Но я все еще получаю ошибку выше.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...