11

I installed the expo cli with

npm i -g exp

then I run

exp

and I get

-bash: exp: command not found

I'm guessing I didn't add exp to path. So how do I do this properly? Nothing I've tried so far works.

Bobby Zhang
  • 175
  • 2
  • 4
  • 11

12 Answers12

22

1. Find the path where expo is globally installed by npm:

npm bin -g

2. Add path from Step 1 to paths file:

sudo vi /etc/paths

3. Restart the Terminal

Rap
  • 6,711
  • 2
  • 48
  • 83
hirdesh tomar
  • 321
  • 2
  • 5
21

This suggested 3 steps solution worked for me:

  1. First check if ~/.npm-global/bin is in your path: echo $PATH. If it isn’t there, you will need to add it to the path.

  2. Open up ~/.bash_profile then add the following line to the bottom: export PATH=$PATH:~/.npm-global/bin

  3. Finally, back in the shell, type: source ~/.bash_profile

Hopefully that will have fixed your problem.

numediaweb
  • 15,000
  • 12
  • 66
  • 105
17

You should try npx expo init <your_app_name> to test.

It worked for me.

Mark Rotteveel
  • 90,369
  • 161
  • 124
  • 175
9

I also had a hard time getting expo command to work on Mac. Here are the steps I took to get it working.

npm root -g shows the directory the global modules are installed in:

/usr/local/Cellar/node/11.7.0/lib/node_modules

That directory might be different for you. After confirming expo is in there, edit ~/.bash_profile and add the line:

export PATH=$PATH:/usr/local/Cellar/node/11.7.0/bin

Save & exit, then run source ~/.bash_profile

Now the expo command should function as intended.

TLC
  • 361
  • 3
  • 5
  • 1
    Only a working solution for me! Search a lot, tried a lot. This is the only fix. Thanks!!! – Kampai Jan 09 '20 at 11:49
4

exp was replaced with expo

To install Expo CLI, just run npm install -g expo-cli (or yarn global add expo-cli, whichever you prefer).

Bill Zelenko
  • 2,208
  • 1
  • 16
  • 24
2

Following on this issue, I found I had multiple global folders so I started using a .npm-global folder as shown here: https://docs.npmjs.com/getting-started/fixing-npm-permissions

And now it's all clean and in control.

flunder
  • 486
  • 6
  • 9
2

try sudo npm install --global expo-cli this worked for me.

➜  MobileDev git:(campaigns-responsive) ✗ expo whoami
› Not logged in, run expo login to authenticate
➜  MobileDev git:(campaigns-responsive) ✗ expo init App
✔ Choose a template: › blank                 a minimal app as clean as an empty canvas
✔ Downloaded and extracted project files.
 Using npm to install packages.
✔ Installed JavaScript dependencies.

✅ Your project is ready!

To run your project, navigate to the directory and run one of the following npm commands.

- cd App
- npm start # you can open iOS, Android, or web from here, or run them directly with the commands below.
- npm run android
- npm run ios
- npm run web
Sreyorn Len
  • 43
  • 1
  • 5
  • Better change access permissions to your dir with global node modules by chmod / chown. Even better install node by nvm. – Daniel Dec 27 '21 at 10:16
0

I have found the solution. Here is the solution for react-native cli. Replace react-native with expo (exp).

Bobby Zhang
  • 175
  • 2
  • 4
  • 11
0

I had a similar issue.

-bash: expo: command not found

It turns out the command to install expo npm install -g expo-cli was referencing an older version of node on my machine; when checked using npm root -g.

So I had to uninstall nvm/node, deleted any remnant folders & files of .nvm and shortcuts for nvm in /usr/local. Then reinstalled node and ran npm install -g expo-cli again.

That fixed my issue.

CodeYute
  • 64
  • 4
0

sudo npm install --unsafe-perm -g expo-cli

Pascal Nitcheu
  • 503
  • 5
  • 6
0

If you're using git bash on windows, add npm path to your system path variables. Generally located on this location:

C:\Users\<Username>\AppData\Roaming\npm

Then open the bash and command npm start. Hope this will help.

Mr.spShuvo
  • 301
  • 3
  • 11
0

I solved it by putting this in my PATH environment variable / user variable:

C:\Users\{userName}\node_modules\.bin
Magiczne
  • 1,540
  • 2
  • 13
  • 21