cstoquer / pixelbox

A sandbox framework to fast-prototype tile-based games in HTML5 and JavaScript
MIT License
470 stars 36 forks source link

Electron app does not build on Apple Silicon devices #26

Open ytrms opened 3 years ago

ytrms commented 3 years ago

Issue: When trying to install the packages necessary to build the Electron app on Apple Silicon devices, npm returns a 404 error since the version of Electron defined in package.json is not available for Apple Silicon devices.

Environment:

Steps to reproduce:

  1. On a machine with Apple Silicon, click on Project -> Electron Prebuild
  2. Navigate to the Electron folder in the project and run npm install. The following error will be returned:

npm ERR! code 1
npm ERR! path /Users/lorenzo/Library/Mobile Documents/com~apple~CloudDocs/programming/gamedev/pixelbox/Halloween-Game-Jam/distrib/electron/node_modules/electron
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! node:internal/process/promises:246
npm ERR!           triggerUncaughtException(err, true /* fromPromise */);
npm ERR!           ^
npm ERR! 
npm ERR! GotError [HTTPError]: Response code 404 (Not Found) for https://github.com/electron/electron/releases/download/v8.2.0/electron-v8.2.0-darwin-arm64.zip
npm ERR!     at EventEmitter.<anonymous> (/Users/lorenzo/Library/Mobile Documents/com~apple~CloudDocs/programming/gamedev/pixelbox/Halloween-Game-Jam/distrib/electron/node_modules/got/source/as-stream.js:35:24)
npm ERR!     at EventEmitter.emit (node:events:390:28)
npm ERR!     at module.exports (/Users/lorenzo/Library/Mobile Documents/com~apple~CloudDocs/programming/gamedev/pixelbox/Halloween-Game-Jam/distrib/electron/node_modules/got/source/get-response.js:22:10)
npm ERR!     at ClientRequest.handleResponse (/Users/lorenzo/Library/Mobile Documents/com~apple~CloudDocs/programming/gamedev/pixelbox/Halloween-Game-Jam/distrib/electron/node_modules/got/source/request-as-event-emitter.js:155:5)
npm ERR!     at Object.onceWrapper (node:events:510:26)
npm ERR!     at ClientRequest.emit (node:events:402:35)
npm ERR!     at ClientRequest.origin.emit (/Users/lorenzo/Library/Mobile Documents/com~apple~CloudDocs/programming/gamedev/pixelbox/Halloween-Game-Jam/distrib/electron/node_modules/@szmarczak/http-timer/source/index.js:37:11)
npm ERR!     at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:623:27)
npm ERR!     at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
npm ERR!     at TLSSocket.socketOnData (node:_http_client:487:22) {
npm ERR!   host: 'github.com',
npm ERR!   hostname: 'github.com',
npm ERR!   method: 'GET',
npm ERR!   path: '/electron/electron/releases/download/v8.2.0/electron-v8.2.0-darwin-arm64.zip',
npm ERR!   socketPath: undefined,
npm ERR!   protocol: 'https:',
npm ERR!   url: 'https://github.com/electron/electron/releases/download/v8.2.0/electron-v8.2.0-darwin-arm64.zip',
npm ERR!   gotOptions: {
npm ERR!     path: '/electron/electron/releases/download/v8.2.0/electron-v8.2.0-darwin-arm64.zip',
npm ERR!     protocol: 'https:',
npm ERR!     slashes: true,
npm ERR!     auth: null,
npm ERR!     host: 'github.com',
npm ERR!     port: null,
npm ERR!     hostname: 'github.com',
npm ERR!     hash: null,
npm ERR!     search: null,
npm ERR!     query: null,
npm ERR!     pathname: '/electron/electron/releases/download/v8.2.0/electron-v8.2.0-darwin-arm64.zip',
npm ERR!     href: 'https://github.com/electron/electron/releases/download/v8.2.0/electron-v8.2.0-darwin-arm64.zip',
npm ERR!     retry: {
npm ERR!       retries: [Function (anonymous)],
npm ERR!       methods: Set(6) { 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' },
npm ERR!       statusCodes: Set(7) { 408, 413, 429, 500, 502, 503, 504 },
npm ERR!       errorCodes: Set(8) {
npm ERR!         'ETIMEDOUT',
npm ERR!         'ECONNRESET',
npm ERR!         'EADDRINUSE',
npm ERR!         'ECONNREFUSED',
npm ERR!         'EPIPE',
npm ERR!         'ENOTFOUND',
npm ERR!         'ENETUNREACH',
npm ERR!         'EAI_AGAIN'
npm ERR!       }
npm ERR!     },
npm ERR!     headers: {
npm ERR!       'user-agent': 'got/9.6.0 (https://github.com/sindresorhus/got)',
npm ERR!       'accept-encoding': 'gzip, deflate'
npm ERR!     },
npm ERR!     hooks: {
npm ERR!       beforeRequest: [],
npm ERR!       beforeRedirect: [],
npm ERR!       beforeRetry: [],
npm ERR!       afterResponse: [],
npm ERR!       beforeError: [],
npm ERR!       init: []
npm ERR!     },
npm ERR!     decompress: true,
npm ERR!     throwHttpErrors: true,
npm ERR!     followRedirect: true,
npm ERR!     stream: true,
npm ERR!     form: false,
npm ERR!     json: false,
npm ERR!     cache: false,
npm ERR!     useElectronNet: false,
npm ERR!     method: 'GET'
npm ERR!   },
npm ERR!   statusCode: 404,
npm ERR!   statusMessage: 'Not Found',
npm ERR!   headers: {
npm ERR!     server: 'GitHub.com',
npm ERR!     date: 'Fri, 29 Oct 2021 04:26:01 GMT',
npm ERR!     'content-type': 'text/plain; charset=utf-8',
npm ERR!     vary: 'X-PJAX, X-PJAX-Container, Accept-Encoding, Accept, X-Requested-With',
npm ERR!     'permissions-policy': 'interest-cohort=()',
npm ERR!     'cache-control': 'no-cache',
npm ERR!     'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
npm ERR!     'x-frame-options': 'deny',
npm ERR!     'x-content-type-options': 'nosniff',
npm ERR!     'x-xss-protection': '0',
npm ERR!     'referrer-policy': 'no-referrer-when-downgrade',
npm ERR!     'expect-ct': 'max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"',
npm ERR!     'content-security-policy': "default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self'; style-src 'unsafe-inline'",
npm ERR!     'content-encoding': 'gzip',
npm ERR!     'content-length': '29',
npm ERR!     'x-github-request-id': '135A:E3DB:134CD2:1B0025:617B77D9',
npm ERR!     connection: 'close'
npm ERR!   },
npm ERR!   body: undefined
npm ERR! }
npm ERR! 
npm ERR! Node.js v17.0.1

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/lorenzo/.npm/_logs/2021-10-29T04_26_02_197Z-debug.log```