m4heshd / better-sqlite3-multiple-ciphers

better-sqlite3 with multiple-cipher encryption support 🔒
MIT License
140 stars 27 forks source link

After electron release build, I got "mapped file has no cdhash" message. #31

Closed passsoon closed 2 years ago

passsoon commented 2 years ago

I changed node-sqlite3 to better-sqlite3-multiple-ciphers. It's very convenient modules, Thanks a lot. :)

I make Electron app using this module But I got following error log after electron release build. Maybe, It looks code sign problem.. (I use electron-builder, and signed using Apple Developer Id key) This problem does not occurred using better-sqlite3 or node-sqlite3

I installed as better-sqlite3 because of knex. yarn add better-sqlite3@npm:better-sqlite3-multiple-ciphers@7.6.2

/private/var/folders/92/v91pnv3108b54dfsr6jn527r0000gn/T/.com.peter.testapp.N81Sor
=> This file is /node_modules/better-sqlite3/Release/better_sqlite3.node It's same size file

=== Log === '/private/var/folders/92/v91pnv3108b54dfsr6jn527r0000gn/T/.com.peter.testapp.N81Sor' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.) at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1812)

I signed manually "/node_modules/better-sqlite3-multiple-ciphers/Release/better_sqlite3.node" using codesign command. but I got another error message

==== Log ==== '/private/var/folders/92/v91pnv3108b54dfsr6jn527r0000gn/T/.com.peter.testapp.HVIPWW' (not a mach-o file)

How can I solve this problem?

Please help me. Thanks in advance.

passsoon commented 2 years ago

I found solutions. :) Add asarUnpack property to electron-builder config

"mac": {
  "icon": "public/assets/icons/mac/512.png",
  ...
  "asar": true,
  "asarUnpack": ["node_modules/better-sqlite3"]
},