Unable to run 'wrangler build': "bad option: --openssl-legacy-provider"

I am learning how to build Workers with Wrangler but I am unable to run wrangler build or publish my worker because I am presented with this error:

$ wrangler build     
/opt/homebrew/bin/node: bad option: --openssl-legacy-provider
Error: failed to execute `"/opt/homebrew/bin/node" "--openssl-legacy-provider" "/Users/me/Library/Caches/.wrangler/wranglerjs-1.19.5" "--output-file=/var/folders/r5/5hxrbdl52z99fh15w0nzt81m0000gn/T/.wranglerjs_outputFgTJF" "--wasm-binding=WASM_MODULE" "--no-webpack-config=1" "--use-entry=/Volumes/me/Sites/workers/my-example-worker/index.js"`: exited with exit status: 9

System: Apple MacBook Pro (2021, M1 Max, macOS Monterey 12.0.1)
Node version installed via homebrew: 17.0.1

Looks like this option is passed for Node 17 (ref). So, for now you can use node 16 instead. You should create an issue on the GitHub though so they can fix this: GitHub - cloudflare/wrangler: 🤠 wrangle your Cloudflare Workers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.