Closed appleseed-iii closed 10 months ago
I also put a re-creation here:
Hi!
That postinstall script basically downloads the Cloudlfared binary and I guess that something went wrong there. Have you tried deleting the node_modules
folder (where the binary is downloaded) and reinstalling the dependencies? So that the process starts from scratch.
Other ideas:
brew install cloudflared
and then SHOPIFY_CLI_CLOUDFLARED_PATH=/opt/homebrew/bin/cloudflared npm run dev
--tunnel-url
. Something like: npm run dev -- --tunnel-url https://your-tunnel.ngrok.com:3000
. More info: https://shopify.dev/docs/apps/tools/cli/commands#dev-flagsLet me know if it helps!
hey thanks. Your three solutions and what I found:
node_modules
and reinstall - technically this just gets me to the same result. Namely, the initial install is fine bc it never hits line 66 of @shopify/plugin-cloudflare/scripts/postinstall.js
. It's just when the postinstall script re-runs that line 66 hits, cloudflared
already exists, so line 66 fails.So are the cloudflared from homebrew & the cloudflared in @shopify/plugin-cloudflare different versions?
More checks:
./node_modules/.pnpm/@shopify+plugin-cloudflare@3.53.0_@types+node@20.11.0_@types+react@18.2.47_typescript@5.3.3/node_modules/@shopify/plugin-cloudflare/bin/cloudflared --version
?softwareupdate --install-rosetta
? That installs Rosetta 2, required to run x64 executables in ARM@gonzaloriestra first one:
% ./node_modules/.pnpm/@shopify+plugin-cloudflare@3.53.0_@types+node@20.11.0_@types+react@18.2.47_typescript@5.3.3/node_modules/@shopify/plugin-cloudflare/bin/cloudflared --version
# => zsh: bad CPU type in executable: ./node_modules/.pnpm/@shopify+plugin-cloudflare@3.53.0_@types+node@20.11.0_@types+react@18.2.47_typescript@5.3.3/node_modules/@shopify/plugin-cloudflare/bin/cloudflared
i'll do the second in just a bit
ok, rosetta fixes the issue completely. nice i wasn't aware of that
Great!
Cloudflare isn't generating ARM releases for some reason, so we need to use the x64 one. It works perfectly with Rosetta, which is suggested by MacOS when required, so most people already have it.
Anyway, we should improve the error message. I see we already have one for this situation, but it seems we are not checking that in the postinstall script. @isaacroldan you added it, just in case you have more info.
That's a good catch, we check this specific error only when you try to run the tunnel (because we assume the first time the install always work). We should check for this error also when running the --version
command.
Please confirm that you have:
In which of these areas are you experiencing a problem?
App, Extension
Expected behavior
on a Mac M3 the line 66 of
@shopify/plugin-cloudflare/scripts/postinstall.js
fails.I've tested this on a Mac M1 & it works fine.
Actual behavior
const versionArray = execFileSync(binTarget, ['--version'], {encoding: 'utf8'}).split(' ')
should return the versionArray; however, it fails.Verbose output
Reproduction steps
pnpm i
works unless postinstall scripts run. On the re-run of theplugin-cloudflare
postinstall script the execFileSync fails. One reason postinstall scripts might run is if.npmrc
includesnode-linker = hoisted
Operating System
Mac OS Sonoma 14.2.1
Shopify CLI version (check your project's
package.json
if you're not sure)3.53.0
Shell
zsh
Node version (run
node -v
if you're not sure)v20.11.0
What language and version are you using in your application?
Node