Expo tunnel not working: CommandError: Please install @expo/ngrok@^4.1.0 and try again
Asked Answered
V

1

11

I am trying to run my Expo app on an iOS device using the ngrok tunnel since I am currently connected to a public wifi that does not allow my iOS device to access the Expo service on my Macbook.

First I tried the suggested command npx expo start --tunnel but its giving a error installing @expo/ngrok even after it has installed it globally.

CommandError: Please install @expo/ngrok@^4.1.0 and try again

% npx expo start --tunnel

Starting project at /Users/foo/expo-project
Starting Metro Bundler
✔ The package @expo/ngrok@^4.1.0 is required to use tunnels, would you like to install it globally? … yes
Installing @expo/ngrok@^4.1.0...
> npm install --global @expo/ngrok@^4.1.0
Installed @expo/ngrok@^4.1.0
CommandError: Please install @expo/ngrok@^4.1.0 and try again

Next I tried installing ngrok using brew and started it on port 3000

enter image description here and started npx expo start --tunnel but it asks again to install @expo/ngrok and fails the installation with the same error.

Also tried npx expo start, used the phone to scan the QR code but it still cant connect to the Expo project, likely because its not trying to connect over the ngrok tunnel.

What else can we try?

Varicose answered 28/3, 2023 at 11:18 Comment(4)
Did you find any resolution to this? I'm suffering from this problem now too. Was working great earlier in the weekKlaus
@Klaus Still having this problem... What version are u using?Varicose
Thanks for checking in, I have moved past the issue. I think the problem was that I wasn't running ngrok from my node_modules, it was installed globally.Klaus
@Klaus Thanks for the update! Will give it another try following your new insights the next time I need to do this.Varicose
Y
19

Installing @expo/ngrok@^4.1.0 both globally and as a dev dependency on the relevant project solved this for me.

Yettayetti answered 15/5, 2023 at 16:56 Comment(2)
seems like I also have to restart my editor or wsl --shutdown after installing as dev dependency? not sure why.Deuteragonist
Installing it as part of the expo starter project did the trick. Now it actually worksPullen

© 2022 - 2025 — McMap. All rights reserved.