ssbc / ssb-db2

A new database for secure-scuttlebutt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node 16 problems?

mixmix opened this issue · comments

I was trying to use ssb-db2 in my updated ssb-ahoy launcher, and got this error:

App threw an error during load
Error: No native build was found for platform=linux arch=x64 runtime=electron abi=103 uv=1 libc=glibc node=16.13.2 electron=18.0.1
    loaded from: /home/mix/projects/SSBC/ssb-ahoy/example/node_modules/ssb-validate2-rsjs-node

    at Function.load.path (/home/mix/projects/SSBC/ssb-ahoy/example/node_modules/node-bindgen-loader/index.js:62:9)
    at load (/home/mix/projects/SSBC/ssb-ahoy/example/node_modules/node-bindgen-loader/index.js:27:30)
    at Object.<anonymous> (/home/mix/projects/SSBC/ssb-ahoy/example/node_modules/ssb-validate2-rsjs-node/index.js:5:41)
    at Module._compile (node:internal/modules/cjs/loader:1116:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1169:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:829:12)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)

This is the current latest electron which internally runs Node 16.

This change fixed it:

const validate2 = require('ssb-validate2')
// const validate2 =
//   typeof localStorage === 'undefined' || localStorage === null
//     ? require('ssb-validate2-rsjs-node')
//     : require('ssb-validate2')
 
commented

Challenging my memory over here ':)

The code shown in @mixmix's fix is used to determine the runtime environment and pull in the appropriate package (are we running in the browser or in node?).

Now I see that Electron is not currently supported by ssb-validate2-rsjs-node (ssbc/ssb-validate2-rsjs-node#13).

I know I had trouble with this part in the past

require('ssb-validate2-rsjs-node')

Something about a rust-based dependency being used on an m1 architecture mac.

Likewise I think I fixed it by changing to the pure node version -- const validate2 = require('ssb-validate2')

Outdated now with ssb-db2@6.0.0