Building electron app on new m1 mac with ipfs fails

I’m trying to build electron project on new MBP with M1 and having tons of issues. I have updated all my dependencies to the latest, and no luck getting it to work. I’m using @electron-forge with web-pack template, wrapping react app. I’m also using libp2p and ipfs for networking.
Here is the output I get when I run yarn install

yarn install v1.22.19
info No lockfile found.
[1/4] 🔍  Resolving packages...
warning electron-eval > electron > electron-download > nugget > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning electron-eval > electron > electron-download > nugget > request > har-validator@5.1.5: this library is no longer supported
warning electron-eval > electron > electron-download > nugget > request > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning ipfs > ipfs-cli > ipfs-daemon > wrtc > node-pre-gyp@0.13.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
warning ipfs > ipfs-cli > ipfs-daemon > ipfs-http-server > it-multipart > formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! 
warning libp2p-secio > libp2p-crypto > multicodec@2.1.3: This module has been superseded by the multiformats module
warning libp2p-secio > libp2p-crypto > multibase@3.1.2: This module has been superseded by the multiformats module
warning libp2p-secio > multiaddr > multibase@3.1.2: This module has been superseded by the multiformats module
warning libp2p-secio > uint8arrays > multibase@3.1.2: This module has been superseded by the multiformats module
warning libp2p-secio > libp2p-interfaces > libp2p-tcp > multiaddr > multibase@4.0.6: This module has been superseded by the multiformats module
warning libp2p-secio > multiaddr > cids@1.1.9: This module has been superseded by the multiformats module
warning libp2p-secio > peer-id > cids@1.1.9: This module has been superseded by the multiformats module
warning libp2p-secio > libp2p-interfaces > libp2p-tcp > multiaddr > cids@1.1.9: This module has been superseded by the multiformats module
warning libp2p-secio > multiaddr > cids > multibase@4.0.6: This module has been superseded by the multiformats module
warning libp2p-secio > multiaddr > cids > multicodec@3.2.1: This module has been superseded by the multiformats module
warning libp2p-secio > peer-id > multihashes > multibase@4.0.6: This module has been superseded by the multiformats module
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "ipfs > ipfs-cli > @multiformats/multiaddr > dns-over-http-resolver > native-fetch@4.0.2" has unmet peer dependency "undici@*".
warning "ipfs > ipfs-core > @libp2p/websockets > @libp2p/utils > ts-node@10.8.2" has unmet peer dependency "@types/node@*".
warning "ipfs > ipfs-core > @libp2p/websockets > @libp2p/utils > ts-node@10.8.2" has unmet peer dependency "typescript@>=2.7".
warning "ipfs > ipfs-core > @libp2p/websockets > @libp2p/utils > ts-mocha@9.0.2" has unmet peer dependency "mocha@^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X || ^8.X.X || ^9.X.X".
warning " > babel-loader@8.2.5" has unmet peer dependency "webpack@>=2".
warning " > css-loader@6.7.1" has unmet peer dependency "webpack@^5.0.0".
warning " > node-loader@2.0.0" has unmet peer dependency "webpack@^5.0.0".
warning " > style-loader@3.3.1" has unmet peer dependency "webpack@^5.0.0".
warning "wrtc@0.4.7" is missing a bundled dependency "node-pre-gyp". This should be reported to the package maintainer.
[4/4] 🔨  Building fresh packages...
[1/11] ⠈ electron
[9/11] ⠈ electron
[8/11] ⠈ ursa-optional
[7/11] ⠈ secp256k1
error /Users/dmitry/hacks/succinctchain/webpack-electron/node_modules/electron-eval/node_modules/electron: Command failed.
Exit code: 1
Command: node install.js
Arguments: 
Directory: /Users/dmitry/hacks/succinctchain/webpack-electron/node_modules/electron-eval/node_modules/electron
Output:
Downloading electron-v1.8.8-darwin-arm64.zip
Error: GET https://github.com/electron/electron/releases/download/v1.8.8/electron-v1.8.8-darwin-arm64.zip returned 404
/Users/dmitry/hacks/succinctchain/webpack-electron/node_modules/electron-eval/node_modules/electron/install.js:47
  throw err
  ^

Error: Failed to find Electron v1.8.8 for darwin-arm64 at https://github.com/electron/electron/releases/download/v1.8.8/electron-v1.8.8-darwin-arm64.zip
    at Request.<anonymous> (/Users/dmitry/hacks/succinctchain/webpack-electron/node_modules/nugget/index.js:169:61)
    at Request.emit (node:events:390:28)
    at Request.onRequestResponse (/Users/dmitry/hacks/succinctchain/webpack-electron/node_modules/request/request.js:1059:10)
    at ClientRequest.emit (node:events:390:28)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:621:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
    at TLSSocket.socketOnData (node:_http_client:487:22)

warning Error running install script for optional dependency: "/Users/dmitry/hacks/succinctchain/webpack-electron/node_modules/wrtc: Command failed.
Exit code: 1
Command: node scripts/download-prebuilt.js
Arguments: 
Directory: /Users/dmitry/hacks/succinctchain/webpack-electron/node_modules/wrtc
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.13.0
node-pre-gyp info using node@16.10.0 | darwin | arm64
node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp info check checked for \"/Users/dmitry/hacks/succinctchain/webpack-electron/node_modules/wrtc/build/Release/wrtc.node\" (not found)
node-pre-gyp http GET https://node-webrtc.s3.amazonaws.com/wrtc/v0.4.7/Release/darwin-arm64.tar.gz
node-pre-gyp http 404 https://node-webrtc.s3.amazonaws.com/wrtc/v0.4.7/Release/darwin-arm64.tar.gz
node-pre-gyp ERR! install error 
node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://node-webrtc.s3.amazonaws.com/wrtc/v0.4.7/Release/darwin-arm64.tar.gz
node-pre-gyp ERR! stack     at Request.<anonymous> (/Users/dmitry/hacks/succinctchain/webpack-electron/node_modules/node-pre-gyp/lib/install.js:149:27)
node-pre-gyp ERR! stack     at Request.emit (node:events:402:35)
node-pre-gyp ERR! stack     at Request.onRequestResponse (/Users/dmitry/hacks/succinctchain/webpack-electron/node_modules/request/request.js:1059:10)
node-pre-gyp ERR! stack     at ClientRequest.emit (node:events:390:28)
node-pre-gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:621:27)
node-pre-gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
node-pre-gyp ERR! stack     at TLSSocket.socketOnData (node:_http_client:487:22)
node-pre-gyp ERR! stack     at TLSSocket.emit (node:events:390:28)
node-pre-gyp ERR! stack     at addChunk (node:internal/streams/readable:315:12)
node-pre-gyp ERR! stack     at readableAddChunk (node:internal/streams/readable:289:9)
node-pre-gyp ERR! System Darwin 21.5.0
node-pre-gyp ERR! command \"/Users/dmitry/.nvm/versions/node/v16.10.0/bin/node\" \"/Users/dmitry/hacks/succinctchain/webpack-electron/node_modules/wrtc/node_modules/.bin/node-pre-gyp\" \"install\"
node-pre-gyp ERR! cwd /Users/dmitry/hacks/succinctchain/webpack-electron/node_modules/wrtc
node-pre-gyp ERR! node -v v16.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok 
404 status code downloading tarball https://node-webrtc.s3.amazonaws.com/wrtc/v0.4.7/Release/darwin-arm64.tar.gz"
info This module is OPTIONAL, you can safely ignore this error
MacBook-Pro:webpack-electron dmitry$ 

Here are dependencies section from my package.json

  "devDependencies": {
    "@babel/core": "^7.18.6",
    "@babel/preset-react": "^7.18.6",
    "electron": "19.0.8",
    "@electron-forge/cli": "^6.0.0-beta.64",
    "@electron-forge/maker-deb": "^6.0.0-beta.64",
    "@electron-forge/maker-rpm": "^6.0.0-beta.64",
    "@electron-forge/maker-squirrel": "^6.0.0-beta.64",
    "@electron-forge/maker-zip": "^6.0.0-beta.64",
    "@electron-forge/plugin-webpack": "6.0.0-beta.64",
    "@vercel/webpack-asset-relocator-loader": "1.7.0",
    "babel-loader": "^8.2.5",
    "css-loader": "^6.0.0",
    "node-loader": "^2.0.0",
    "style-loader": "^3.0.0"
  },
  "dependencies": {
    "electron-is-dev": "2.0.0",
    "electron-eval": "0.9.10",
    "express": "4.18.1",
		"flash-store": "1.0.6",
		"fs-extra": "10.1.0",
		"ipfs": "0.63.5",
		"ipfs-pubsub-room": "3.0.0",
		"libp2p": "0.37.3",
		"libp2p-gossipsub": "0.13.0",
		"libp2p-kad-dht": "0.28.6",
		"libp2p-mdns": "^0.18.0",
		"libp2p-mplex": "0.10.7",
		"libp2p-pubsub": "0.9.1",
		"libp2p-secio": "0.13.1",
		"libp2p-tcp": "^0.17.2",    
		"moment": "2.29.4",
		"node-fetch": "3.2.6",
		"obj2fs-hoc": "1.3.2",
    "electron-squirrel-startup": "^1.0.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "uuid": "8.3.2"		
  }

And I’m on node v16.10.0

I really have no idea where to go with this next, would really appreciate any advice for troubleshooting.

This also has a StackOverflow question: node.js - Building electron app on new m1 mac fails - Stack Overflow

I’ve tried looking into it. It seems to be failing because it’s trying to grab Electron v1.8.8 instead of the specified Electron v19.0.8 (which should work fine), but I have absolutely no idea why that’s happening.

Might be related to this: Can't install on mac m1 · Issue #485 · electron/electron-api-demos · GitHub (but could also be a red herring, as there’s not much info in that issue)

But, what is trying to grab electron v1.8.8? I’m explicitly referencing the “electron”: “19.0.8”.

That’s the mystery, I have no idea why. Hoping someone else will, I’m very sorry. I spent a while digging through things and was left with more questions than answers.

I found a solution,
Someone replied on stack overflow node.js - Building electron app on new m1 mac fails - Stack Overflow
I had electron-eval in my dependencies which was trying to bring in the wrong version of electron.
Thanks all for your help.