2016-12-19 1 views
1

ich eine C# .NET-Komponente habe ich würde in meinem Elektron project.I hat diese Bibliothek edge.js aber baut die App unter Fehlern zeigen verwendet intergrateElectron mit nativen C# -Code erstreckt

Uncaught Exception: 
Error: /var/www/edge-electron/node_modules/electron-edge/build/Release/edge_nativeclr.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEi 
    at Error (native) 
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20) 
    at Object.Module._extensions..node (module.js:583:18) 
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20) 
    at Module.load (module.js:473:32) 
    at tryModuleLoad (module.js:432:12) 
    at Function.Module._load (module.js:424:3) 
    at Module.require (module.js:483:17) 
    at require (internal/module.js:20:19) 
    at Object.<anonymous> (/var/www/edge-electron/node_modules/electron-edge/lib/edge.js:49:8) 

Im Folgenden Beispielcode von ist Elektronenkodierplatte mit edge.js Beispielcode

const electron = require('electron') 
const edge = require('edge') 
// Module to control application life. 
const app = electron.app 
// Module to create native browser window. 
const BrowserWindow = electron.BrowserWindow 

const path = require('path') 
const url = require('url') 

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

var helloWorld = edge.func(` 
    async (input) => { 
    return '.NET Welcomes ' + input.ToString() 
    } 
`) 

function createWindow() { 
    // Create the browser window. 
    mainWindow = new BrowserWindow({width: 800, height: 600}) 

    // and load the index.html of the app. 
    mainWindow.loadURL(url.format({ 
    pathname: path.join(__dirname, 'index.html'), 
    protocol: 'file:', 
    slashes: true 
    })) 

    // Open the DevTools. 
    mainWindow.webContents.openDevTools() 

    // Emitted when the window is closed. 
    mainWindow.on('closed', function() { 
    // Dereference the window object, usually you would store windows 
    // in an array if your app supports multi windows, this is the time 
    // when you should delete the corresponding element. 
    mainWindow = null 
    }) 

    // Edge functionality 
    mainWindow.on('show', function() { 
    // Dereference the window object, usually you would store windows 
    console.log('shown') 
    helloWorld('JavaScript', function (error, result) { 
     if (error) throw error 
     console.log(result) 
    }) 
    }) 
} 

// 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', function() { 
    // 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', function() { 
    // 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() 
    } 
}) 

// In this file you can include the rest of your app's specific main process 
// code. You can also put them in separate files and require them here. 

Irgendwelche Ideen, wie ich darüber gehen würde, irgendwelche Alternativen? irgendetwas?

+0

Haben Sie einen Debug-Build versucht? Die Frage ist, welches Symbol eigentlich fehlt ... – Konstantin

+0

@Konstantin nein, wusste nicht, aber ich dachte, Problem war, war auf Knoten Wiederaufbau –

+0

Dann ist es wert, Ihre eigene Frage mit so vielen Details wie möglich zu beantworten und dann akzeptieren. Es könnte am Ende jemand anderem helfen. – Konstantin

Antwort

1

Ich hatte das gleiche Problem. Verwenden Sie einfach electron-edge und alles wird funktionieren.

Verwandte Themen