httptoolkit / httptoolkit-ui

The UI of HTTP Toolkit
https://httptoolkit.com
GNU Affero General Public License v3.0
290 stars 108 forks source link

darwin-arm64 error #69

Open agungyuliaji opened 1 year ago

agungyuliaji commented 1 year ago

it was fine for commit 07c8da06caf467def52b2da6086a2a72b74b7a20 (when I first cloned this) But after pull latest update i get this error: there is a missing build for darwin-arm64

[start:web   ] 
[start:web   ] > httptoolkit-ui@0.1.0 start:web
[start:web   ] > env-cmd -f ./automation/ts-node.env webpack-dev-server --config ./automation/webpack.dev.ts
[start:web   ] 
[start:server] 
[start:server] > httptoolkit-ui@0.1.0 start:server
[start:server] > npm-run-all server:setup server:start
[start:server] 
[start:server] 
[start:server] > httptoolkit-ui@0.1.0 server:setup
[start:server] > ts-node -P ./automation/tsconfig.json ./automation/setup-server.ts
[start:server] 
[start:web   ] ℹ 「wds」: Project is running at http://local.httptoolkit.tech:8080/
[start:web   ] ℹ 「wds」: webpack output is served from /
[start:web   ] ℹ 「wds」: Content not from webpack is served from /Users/orangganteng/Workspaces/httptoolkit-ui/dist
[start:web   ] ℹ 「wds」: 404s will fallback to /index.html
[start:server] Downloading latest httptoolkit-server...
[start:server] Error: No server download available matching /httptoolkit-server-v[\d\.]+-darwin-arm64\.tar\.gz/
[start:server]     at /Users/orangganteng/Workspaces/httptoolkit-ui/automation/setup-server.ts:79:15
[start:server]     at Generator.next (<anonymous>)
[start:server]     at /Users/orangganteng/Workspaces/httptoolkit-ui/automation/setup-server.ts:31:71
[start:server]     at new Promise (<anonymous>)
[start:server]     at __awaiter (/Users/orangganteng/Workspaces/httptoolkit-ui/automation/setup-server.ts:27:12)
[start:server]     at downloadServer (/Users/orangganteng/Workspaces/httptoolkit-ui/automation/setup-server.ts:90:12)
[start:server]     at /Users/orangganteng/Workspaces/httptoolkit-ui/automation/setup-server.ts:37:15
[start:server]     at Generator.next (<anonymous>)
[start:server]     at fulfilled (/Users/orangganteng/Workspaces/httptoolkit-ui/automation/setup-server.ts:28:58)
[start:server]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[start:server] ERROR: "server:setup" exited with 1.
[start:web   ] 
[start:web   ] /Users/orangganteng/Workspaces/httptoolkit-ui/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:4
[start:web   ]     return new (P || (P = Promise))(function (resolve, reject) {
[start:web   ]            ^
[start:web   ] RpcIpcMessagePortClosedError: Process 7295 exited [SIGTERM].
[start:web   ]     at /Users/orangganteng/Workspaces/httptoolkit-ui/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:19:23
[start:web   ]     at Generator.next (<anonymous>)
[start:web   ]     at /Users/orangganteng/Workspaces/httptoolkit-ui/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:8:71
[start:web   ]     at new Promise (<anonymous>)
[start:web   ]     at __awaiter (/Users/orangganteng/Workspaces/httptoolkit-ui/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:4:12)
[start:web   ]     at ChildProcess.handleExit (/Users/orangganteng/Workspaces/httptoolkit-ui/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:18:42)
[start:web   ]     at ChildProcess.emit (node:events:513:28)
[start:web   ]     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
pimterry commented 1 year ago

Ah, interesting! This is because we've just changed how the server is bundled here, moving from the npm approach (which was using a wildly out of date server, and basically running straight from dev sources etc) to automatically pulling & launching the official releases directly.

Unfortunately though, there's no official arm64-specific releases. The quick fix for now is to run the server independently (see the server README) and then just run npm run start:web here, to run the UI without automatically starting a server. That should behave pretty much identically to what it was doing before.

The real issue here is https://github.com/httptoolkit/httptoolkit/issues/371 - the server is not officially built for darwin-arm64 at all yet, it just runs via Rosetta 2 instead. As you've discovered, it is possible to run from source, it's just that the deployment pipeline for all that doesn't fully exist yet (PRs towards the steps in that issue are welcome!).

As an alternative, if the built x64 releases do work fine for you (they should, via Rosetta) then it might be possible to do a quick workaround to still use npm start directly by overriding the architecture downloaded in this situation, and automatically downloading the darwin-x64 version when running on darwin-arm64, for now until https://github.com/httptoolkit/httptoolkit/issues/371 is completed. The script that sets up the dev server for this repo is in https://github.com/httptoolkit/httptoolkit-ui/blob/main/automation/setup-server.ts - PRs for that quick workarounds there to solve this for M1 Macs are welcome.