"No native build was found for platform" when running "yarn start"
When following the "Running from Source" instructions, I encountered the following error:
$ nvm use 12
...
$ yarn
...
$ yarn start
...
A JavaScript error occurred in the main process
Uncaught Exception:
Error: No native build was found for platform=linux arch=x64 runtime=electron abi=75 uv=1 libc=glibc
at Function.load.path (/home/maxime/code/pushpin/node_modules/sodium-native/node_modules/node-gyp-build/index.js:55:9)
at load (/home/maxime/code/pushpin/node_modules/sodium-native/node_modules/node-gyp-build/index.js:20:30)
at Object.<anonymous> (/home/maxime/code/pushpin/node_modules/sodium-native/index.js:1:39)
at Module._compile (internal/modules/cjs/loader.js:880:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:892:10)
at Module.load (internal/modules/cjs/loader.js:735:32)
at Module._load (internal/modules/cjs/loader.js:648:12)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:775:19)
...
I already have nvm set up on my machine, and nvm use 12 did work:
$ node -v
v12.16.2
I'm running on Ubuntu 20.04. Has anyone encountered this?
Full output of yarn start
$ yarn start
yarn run v1.22.5
$ ts-node ./scripts/start.ts
(node:6680) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from undefined
ℹ 「wds」: Content not from webpack is served from /home/maxime/code/pushpin/dist
Starting type checking service...
Using 1 worker with 2048MB memory limit
Starting type checking service...
Using 1 worker with 2048MB memory limit
Starting type checking service...
Using 1 worker with 2048MB memory limit
Starting type checking service...
Using 1 worker with 2048MB memory limit
Type checking in progress...
ℹ 「wdm」: Hash: b91616a015783ffdf5d2
Version: webpack 4.35.2
Time: 8754ms
Built at: 01/28/2021 10:45:18 AM
Asset Size Chunks Chunk Names
assets/IBMPlexMono-Bold.woff2 36 KiB [emitted]
assets/IBMPlexMono-Regular.woff2 34.7 KiB [emitted]
assets/IBMPlexSans-Bold.woff2 54.8 KiB [emitted]
assets/IBMPlexSans-Italic.woff2 59.2 KiB [emitted]
assets/IBMPlexSans-Medium.woff 79.8 KiB [emitted]
assets/IBMPlexSans-Medium.woff2 58.3 KiB [emitted]
assets/IBMPlexSans-Regular.woff2 54.9 KiB [emitted]
assets/IBMPlexSans-SemiBold.woff2 58.6 KiB [emitted]
assets/corner.svg 641 bytes [emitted]
assets/default-avatar.png 11.4 KiB [emitted]
assets/grid.svg 928 bytes [emitted]
assets/line-awesome.eot 110 KiB [emitted]
assets/line-awesome.svg 424 KiB [emitted]
assets/line-awesome.ttf 110 KiB [emitted]
assets/line-awesome.woff 56.1 KiB [emitted]
assets/line-awesome.woff2 44.1 KiB [emitted]
b03afe0b972f6d54dcda.worker.js 1.64 MiB [emitted]
background.html 194 bytes [emitted]
background.js 151 KiB background [emitted] background
index.html 180 bytes [emitted]
renderer.js 815 KiB renderer [emitted] renderer
Entrypoint renderer = renderer.js
Entrypoint background = background.js
[0] multi (webpack)-dev-server/client?http://localhost (webpack)/hot/only-dev-server.js ./src/renderer 52 bytes {renderer} [built]
[1] multi (webpack)-dev-server/client?http://localhost (webpack)/hot/only-dev-server.js ./src/background 52 bytes {background} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost] (webpack)-dev-server/client?http://localhost 4.29 KiB {renderer} {background} [built]
[./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.51 KiB {renderer} {background} [built]
[./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {renderer} {background} [built]
[./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.77 KiB {renderer} {background} [built]
[./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {renderer} {background} [built]
[./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-server/client/utils/reloadApp.js 1.63 KiB {renderer} {background} [built]
[./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-server/client/utils/sendMessage.js 402 bytes {renderer} {background} [built]
[./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {renderer} {background} [built]
[./node_modules/webpack/hot/emitter.js] (webpack)/hot/emitter.js 75 bytes {renderer} {background} [built]
[./node_modules/webpack/hot/log-apply-result.js] (webpack)/hot/log-apply-result.js 1.27 KiB {renderer} {background} [built]
[./node_modules/webpack/hot/only-dev-server.js] (webpack)/hot/only-dev-server.js 2.52 KiB {renderer} {background} [built]
[./src/background/index.tsx] 2.42 KiB {background} [built]
[./src/renderer/index.tsx] 3.82 KiB {renderer} [built]
+ 310 hidden modules
Child html-webpack-plugin for "background.html":
Asset Size Chunks Chunk Names
background.html 577 KiB 0
Entrypoint undefined = background.html
[./node_modules/html-webpack-plugin/lib/loader.js!./node_modules/html-webpack-plugin/default_index.ejs] 376 bytes {0} [built]
[./node_modules/lodash/lodash.js] 530 KiB {0} [built]
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {0} [built]
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 577 KiB 0
Entrypoint undefined = index.html
[./node_modules/html-webpack-plugin/lib/loader.js!./node_modules/html-webpack-plugin/default_index.ejs] 376 bytes {0} [built]
[./node_modules/lodash/lodash.js] 530 KiB {0} [built]
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {0} [built]
Child worker:
Asset Size Chunks Chunk Names
b03afe0b972f6d54dcda.worker.js 1.64 MiB main [emitted] main
Entrypoint main = b03afe0b972f6d54dcda.worker.js
[./node_modules/pdfjs-dist/build/pdf.worker.js] 1.55 MiB {main} [built]
[./node_modules/react-pdf/dist/pdf.worker.entry.js] 475 bytes {main} [built]
ℹ 「wdm」: Compiled successfully.
No type errors found
Version: typescript 3.7.2
Time: 12941ms
Starting type checking service...
Using 1 worker with 2048MB memory limit
Type checking in progress...
Starting type checking service...
Using 1 worker with 2048MB memory limit
Type checking in progress...
Starting type checking service...
Using 1 worker with 2048MB memory limit
App threw an error during load
Error: No native build was found for platform=linux arch=x64 runtime=electron abi=75 uv=1 libc=glibc
at Function.load.path (/home/maxime/code/pushpin/node_modules/sodium-native/node_modules/node-gyp-build/index.js:55:9)
at load (/home/maxime/code/pushpin/node_modules/sodium-native/node_modules/node-gyp-build/index.js:20:30)
at Object.<anonymous> (/home/maxime/code/pushpin/node_modules/sodium-native/index.js:1:39)
at Module._compile (internal/modules/cjs/loader.js:880:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:892:10)
at Module.load (internal/modules/cjs/loader.js:735:32)
at Module._load (internal/modules/cjs/loader.js:648:12)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:775:19)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: No native build was found for platform=linux arch=x64 runtime=electron abi=75 uv=1 libc=glibc
at Function.load.path (/home/maxime/code/pushpin/node_modules/sodium-native/node_modules/node-gyp-build/index.js:55:9)
at load (/home/maxime/code/pushpin/node_modules/sodium-native/node_modules/node-gyp-build/index.js:20:30)
at Object.<anonymous> (/home/maxime/code/pushpin/node_modules/sodium-native/index.js:1:39)
at Module._compile (internal/modules/cjs/loader.js:880:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:892:10)
at Module.load (internal/modules/cjs/loader.js:735:32)
at Module._load (internal/modules/cjs/loader.js:648:12)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:775:19)
Type checking in progress...
No type errors found
Version: typescript 3.7.2
Time: 10751ms
No type errors found
Version: typescript 3.7.2
Time: 10747ms
No type errors found
Version: typescript 3.7.2
Time: 10681ms
^C
One curious thing is that the error message mentions ABI version 75. According to the Node release page, 12.16.2 has ABI version 72. Could this error perhaps be due to a binary incompatibility between Electron and Node, or something like that?
I did try updating Node to the latest 12.x LTS release, 12.20.1, but that also has ABI 72 on the release page, and I still get ABI 75 in the error message. Unfortunately, there are no Node releases on the page that have ABI 75, so I wasn't able to test with a Node version that has ABI 75.
Augh, sodium-native has been a thorn in my side forever. The first thing to know is that you need an Electron build of sodium-native, not a node-12 one. That's because Electron has its own Node engine with its own binary dependencies. I'm not sure why it's telling you that it can't find a prebuilt sodium-native binary but you can probably build your own. Try yarn build?
Hi @pvh, could you elaborate more how to fix this issue? Im not familiar with Electron and building my own sodium-native binary. Thank you in advance!
What worked for me (Ubuntu 20.04):
sudo apt install g++ python
npm i -g yarn prebuildify
yarn
cd node_modules/sodium-native
yarn prebuild
cd ../../
yarn
yarn start
But the prebuild step took a veeeery long time... and finishes with an error (something about v8_enable_pointer_compression on electron 10...) but the necesssary files compiled before that (electron 7.2.4? I dont know).
There might be an easier way (maybe using electron-rebuild, npm rebuild or a combination of those tools, I tried some without success), if anyone has a shorter path please share ;).