workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

wrangler typegen fails on MacOS Monterey Version 12.7.6 (21H1320)

Open bikash119 opened this issue 8 months ago • 5 comments

What versions & operating system are you using?

MacOS 12.7.6 (21H1320), node : 22.14.0, npm 10.9.2

Please provide a link to a minimal reproduction

https://gist.github.com/bikash119/bf77aeef9d886d3fcf68796a8ae9a0a1

Describe the Bug

Error occurs when tried to create project on MacOS Monterey using npm create cloudflare@latest.

Please provide any relevant error logs

Error log


--- 2025-05-28T06:01:29.031Z debug
🪵  Writing logs to "/Users/boredmgr/Library/Preferences/.wrangler/logs/wrangler-2025-05-28_06-01-28_851.log"
---

--- 2025-05-28T06:01:29.031Z debug
Metrics dispatcher: Posting data {"deviceId":"a5847bd1-ae19-4037-847d-da6b141f9944","event":"wrangler command started","timestamp":1748412089031,"properties":{"amplitude_session_id":1748412089025,"amplitude_event_id":0,"wranglerVersion":"4.17.0","osPlatform":"Mac OS","osVersion":"Darwin Kernel Version 21.6.0: Mon Jun 24 00:56:10 PDT 2024; root:xnu-8020.240.18.709.2~1/RELEASE_X86_64","nodeVersion":22,"packageManager":"npm","isFirstUsage":false,"configFileType":"jsonc","isCI":false,"isPagesCI":false,"isWorkersCI":false,"isInteractive":true,"hasAssets":false,"argsUsed":[],"argsCombination":"","command":"wrangler types","args":{"xJsonConfig":true,"j":true,"envInterface":"<REDACTED>","includeRuntime":true,"includeEnv":true,"strictVars":true,"path":"worker-configuration.d.ts"}}}
---

--- 2025-05-28T06:01:29.041Z debug
.env file not found at ".env". Continuing... For more details, refer to https://developers.cloudflare.com/workers/wrangler/system-environment-variables/
---

--- 2025-05-28T06:01:29.103Z log

 ⛅️ wrangler 4.17.0
[38;2;255;136;0m───────────────────[39m
---

--- 2025-05-28T06:01:29.132Z log
Generating project types...

---

--- 2025-05-28T06:01:29.134Z debug
.env file not found at ".dev.vars". Continuing... For more details, refer to https://developers.cloudflare.com/workers/wrangler/system-environment-variables/
---

--- 2025-05-28T06:01:29.135Z log
[2mdeclare namespace Cloudflare {[22m
[2m	interface Env {[22m
[2m		VALUE_FROM_CLOUDFLARE: "Hello from Cloudflare";[22m
[2m	}[22m
[2m}[22m
[2minterface Env extends Cloudflare.Env {}[22m
[2m[22m
---

--- 2025-05-28T06:01:29.135Z log
Generating runtime types...

---

--- 2025-05-28T06:01:30.503Z log

---

--- 2025-05-28T06:01:30.565Z error
[31m✘ [41;31m[[41;97mERROR[41;31m][0m [1mwrite EPIPE[0m


---

--- 2025-05-28T06:01:30.565Z debug
Error: write EPIPE
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:87:19)
    at WriteWrap.callbackTrampoline (node:internal/async_hooks:130:17)
---

--- 2025-05-28T06:01:30.566Z log
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m
---

--- 2025-05-28T06:01:36.702Z debug
Sentry: Capturing exception Error: write EPIPE
---

--- 2025-05-28T06:01:36.708Z debug
Metrics dispatcher: Posting data {"deviceId":"a5847bd1-ae19-4037-847d-da6b141f9944","event":"wrangler command errored","timestamp":1748412096708,"properties":{"amplitude_session_id":1748412089025,"amplitude_event_id":1,"wranglerVersion":"4.17.0","osPlatform":"Mac OS","osVersion":"Darwin Kernel Version 21.6.0: Mon Jun 24 00:56:10 PDT 2024; root:xnu-8020.240.18.709.2~1/RELEASE_X86_64","nodeVersion":22,"packageManager":"npm","isFirstUsage":false,"configFileType":"jsonc","isCI":false,"isPagesCI":false,"isWorkersCI":false,"isInteractive":true,"hasAssets":false,"argsUsed":[],"argsCombination":"","command":"wrangler types","args":{"xJsonConfig":true,"j":true,"envInterface":"<REDACTED>","includeRuntime":true,"includeEnv":true,"strictVars":true,"path":"worker-configuration.d.ts"},"durationMs":7705,"durationSeconds":7.705,"durationMinutes":0.12841666666666668,"errorType":"Error"}}
---

bikash119 avatar May 28 '25 06:05 bikash119

npm create cloudflare@latest : This command broke on MacOS Monterey(12.7.6). The specific command that failed is wrangler types. So after executing the above command, let it fail. Downgrade @cloudflare@vite-plugin and wrangler version to [email protected] and @cloudflare/[email protected] by using the npm install -D [email protected] @cloudflare/[email protected]. Post this downgrade wrangler types will start working.

bikash119 avatar May 28 '25 13:05 bikash119

Hi, wrangler (and create-cloudflare) is only supported on macOS 13.5+. Downgrading would allow you to generate the template, but you would probably run into issues when you start developing.

We've got this documnted for wrangler, but it does seem create-cloudflare doesn't mention this requirement - we should fix that.

emily-shen avatar Jun 02 '25 13:06 emily-shen

Thanks @emily-shen . I haven't faced any issue yet, 🤞 . But updating the requirement for create-cloudflare would help

bikash119 avatar Jun 11 '25 08:06 bikash119

There are a whole lot of Intel based macs still used in industry. All those will be running MacOS 12.7.6, and will be stuck at that.

I'de highly suggest that the cloudflare team spends time to add this into their compatibility layer when testing.

Or, add telemetry layer into you're tooling so you know your audience. If you engineering manager needs some tips I'll gladly help!

gavan-x avatar Jun 15 '25 04:06 gavan-x

+1

tuanductran avatar Jun 17 '25 06:06 tuanductran

Sadly we will not be able to support older versions of MacOS for workerd, and therefore none of the tooling that depends upon it, e.g. Miniflare, Wrangler, Vite plugin, Vitest integration, etc.

As a workaround you could run Wrangler in a dev container on your machine that emulates a unix OS.

petebacondarwin avatar Jul 07 '25 12:07 petebacondarwin

We are going to improve the error message here - moving to the backlog.

(As Pete mentioned workerd does not support older MacOS unfortunately)

vicb avatar Jul 07 '25 13:07 vicb