Error when adding custom native code

I followed this docs: Adding custom native code - Expo Documentation
But when i ran expo run:ios, I got the error: "run:ios" is not an expo command. See "expo --help" for the full list of commands.
The result is the same when i ran expo run:android
Please help me, thanks.

You should try upgrading/reinstalling Expo CLI

My current Expo version is 3.28.5. Is there any problem with this?

It’s ~9 months old, so it doesn’t have the newest features ( like expo run:ios)

I tried to run npm install -g expo-cli, then i see the expo-cli@4.9.1 was added. But when i ran “expo-cli --version”, i got the old version. It was 3.28.5

you might have another version of expo-cli installed, either globally or maybe in a particular project


type -a expo
which expo

That will tell you where the old version of the expo command is.

Then try:

npm bin -g

That should in theory tell you where the new version was installed to.

There are several possible ways to proceed from there, but ultimately you want to have the location of the new expo command in your PATH environment variable before the location where the old version of the expo command. You probably also want to uninstall/remove the old version of the expo command.

Thanks @wodin and @charliecruzan . After some steps related to the $PATH, I got the latest version of Expo.
But I have new problems.

  • I must run source ~/.bash_profile every time I open a new Terminal.
  • Expo command can be found when I run by Terminal, but VS Code is not.

At least the first issue should be solved by logging out and back in again (or rebooting).
The second will likely also be fixed by logging out and back in.

I fixed the error in VS Code by changing the global package directory. It worked. Thank you both.

1 Like

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