I am attempting to build the desktop app with a view to submitting a pull request.
I am following the BUILD.md guide.
When I run cd packages/app-desktop then yarn start Electron opens but there is an error in the console:
Uncaught Error: Cannot find module '/home/jp/joplin/packages/app-desktop/node_modules/sqlite3/lib/binding/napi-v6-darwin-unknown-arm64/node_sqlite3.node'
Require stack:
- /home/jp/joplin/packages/app-desktop/node_modules/sqlite3/lib/sqlite3-binding.js
- /home/jp/joplin/packages/app-desktop/node_modules/sqlite3/lib/sqlite3.js
- /home/jp/joplin/packages/app-desktop/index.html
at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
at i._resolveFilename (node:electron/js2c/renderer_init:33:1095)
at Module._load (node:internal/modules/cjs/loader:785:27)
at c._load (node:electron/js2c/asar_bundle:5:13343)
at i._load (node:electron/js2c/renderer_init:33:356)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/jp/joplin/packages/app-desktop/node_modules/sqlite3/lib/sqlite3-binding.js:4:17)
at Object.<anonymous> (/home/jp/joplin/packages/app-desktop/node_modules/sqlite3/lib/sqlite3-binding.js:7:3)
at Module._compile (node:internal/modules/cjs/loader:1118:14)
This is on an M1 Mac.
Instead of napi-v6-darwin-unknown-arm64 I have an napi-v6-darwin-unknown-x64 directory.
So it seems that Joplin is using the correct architecture, arm64, but yarn has installed the wrong one.
I am unfamiliar with how yarn chooses which architecture to install.
Has anyone successfully built Joplin on an M1 Mac?
There are flags to build for M1 using npm, and there might be some for yarn too. It's not really specific to Joplin so you might have more luck on SO or the sqlite repo
Hi @laurent - thanks for your response. I am still struggling to build Joplin on my M1 Mac. When you say there are flags to build for M1 using npm, could you provide a bit more context? Where can I find these flags? I don't mind whether I build using npm or yarn, if it's easier to build using npm.
The reason I want to build Joplin is so I can contribute a fix for this issue that I raised: