We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I'm a starter of electron and nodejs, also ffi
ox : Darwin mac-dev.local 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64 node: v10.15.2 x64 npm: 6.4.1
package.json { "name": "helloworld", "version": "1.0.0", "description": "Hello Electron", "main": "main.js", "scripts": { "npm-install": "npm i", "package": "electron-packager . HelloElectron --all", "start": "electron .", "bs": "npm build && npm start", "postinstall": "electron-builder --mac --x64 install-app-deps" }, "author": "Jack Martin", "license": "ISC", "repository": { "private": true }, "devDependencies": { "asar": "^1.0.0", "electron": "4.0.3", "electron-builder": "^20.39.0", "electron-packager": "^13.1.1", "ffi": "^2.3.0" }, "dependencies": { "ref": "^1.3.5" } }
{ "name": "helloworld", "version": "1.0.0", "description": "Hello Electron", "main": "main.js", "scripts": { "npm-install": "npm i", "package": "electron-packager . HelloElectron --all", "start": "electron .", "bs": "npm build && npm start", "postinstall": "electron-builder --mac --x64 install-app-deps" }, "author": "Jack Martin", "license": "ISC", "repository": { "private": true }, "devDependencies": { "asar": "^1.0.0", "electron": "4.0.3", "electron-builder": "^20.39.0", "electron-packager": "^13.1.1", "ffi": "^2.3.0" }, "dependencies": { "ref": "^1.3.5" } }
main.js just create a basic window and load index.html
index.html
<body> <div> <button type="button" onclick="hello()">Call Hello</button> </div> <span id="hello"></span> <script> window.onload = function () { try { var ref = require('ref'); // let ffi = require('ffi'); // console.log('fii.Library result:', ffi); // window.lib = ffi.Library('test.dylib', { // hello: ['int', ['pointer']] // }); // console.log('fii.Library result:', window.lib); } catch (error) { console.error('ffi.Library', error); } }; function hello() { // let callback = require('ffi').Callback('void', ['int', 'string'], function (size, reply) { // document.getElementById('hello').innerHTML = reply; // }); // window.lib.hello(callback); } </script> </body>
npm i works well npm start with the error below
dyld: lazy symbol binding failed: Symbol not found: __ZN2v811HandleScope12CreateHandleEPNS_8internal10HeapObjectEPNS1_6ObjectE Referenced from: /Users/jack/Desktop/test/electron/HelloWorld/node_modules/ref/build/Release/binding.node Expected in: flat namespace dyld: Symbol not found: __ZN2v811HandleScope12CreateHandleEPNS_8internal10HeapObjectEPNS1_6ObjectE Referenced from: /Users/jack/Desktop/test/electron/HelloWorld/node_modules/ref/build/Release/binding.node Expected in: flat namespace
I find nothing help when searching the google.
Its nothing to do with the ffi but the ref its self.
Could anyone help me of out this?
The text was updated successfully, but these errors were encountered:
Hello, have you solved your problem? I had the same problem
Sorry, something went wrong.
https://electronjs.org/docs/tutorial/using-native-node-modules 执行下面这条命令就可解决: ./node_modules/.bin/electron-rebuild
No branches or pull requests
Hi, I'm a starter of electron and nodejs, also ffi
ox : Darwin mac-dev.local 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64
node: v10.15.2 x64
npm: 6.4.1
package.json
{ "name": "helloworld", "version": "1.0.0", "description": "Hello Electron", "main": "main.js", "scripts": { "npm-install": "npm i", "package": "electron-packager . HelloElectron --all", "start": "electron .", "bs": "npm build && npm start", "postinstall": "electron-builder --mac --x64 install-app-deps" }, "author": "Jack Martin", "license": "ISC", "repository": { "private": true }, "devDependencies": { "asar": "^1.0.0", "electron": "4.0.3", "electron-builder": "^20.39.0", "electron-packager": "^13.1.1", "ffi": "^2.3.0" }, "dependencies": { "ref": "^1.3.5" } }
main.js
just create a basic window and load index.html
index.html
npm i works well
npm start with the error below
I find nothing help when searching the google.
Its nothing to do with the ffi but the ref its self.
Could anyone help me of out this?
The text was updated successfully, but these errors were encountered: