Shopify CLI 3.0 migration failing with ngrok permission error

I’m stuck upgrading my shopify application to CLI 3.0 and getting permission errors

Hey everyone! I’ve been trying to update my shopify app to use the new CLI version 3.0 following the official migration guide. I’m running into some issues that I can’t seem to fix.

My setup:

  • macOS Catalina 10.15.17
  • Node.js: 16.15.1
  • Ruby: 2.6.3p62
  • Current Shopify CLI: 2.19.0

What I did so far:

  1. Moved all my source code into the /web directory
  2. Created the required config files (web/shopify.web.toml and shopify.app.toml)
  3. Set up the new package.json file
  4. Ran the installation command

The problem:
When I execute sudo npm install, the process fails during ngrok setup with permission errors:

npm ERR! code 1
npm ERR! path /Users/john/my-shop-app/node_modules/@shopify/ngrok
npm ERR! command failed
npm ERR! ngrok - error storing binary to local file [Error: EACCES: permission denied, open '/Users/john/.ngrok/binary-file.zip']
npm ERR! errno: -13
npm ERR! code: 'EACCES'
npm ERR! syscall: 'open'
npm ERR! ngrok - install failed, retrying

The error keeps repeating and eventually the whole installation fails. Has anyone run into this before? What’s the best way to fix these permission issues?