12

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
  • 205
  • 2
  • 6
  • 11
  • 1
    Does this answer your question? [react-native: command not found](https://stackoverflow.com/questions/37189081/react-native-command-not-found) – Nimantha Jun 23 '22 at 02:27
  • I have found the solution. [Here](https://stackoverflow.com/questions/37189081/react-native-command-not-found) is the solution for react-native cli. Replace react-native with expo (exp). – Bobby Zhang Aug 13 '18 at 13:53
  • try `export PATH=$PATH:node_modules/.bin` – lkahtz Dec 07 '22 at 08:01

13 Answers13

28

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

It worked for me.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
0xcuonghx
  • 450
  • 5
  • 4
22

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
  • 16,362
  • 12
  • 74
  • 110
21

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,851
  • 3
  • 50
  • 88
hirdesh tomar
  • 319
  • 2
  • 5
10

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
  • 371
  • 3
  • 6
  • 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
10

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
  • 123
  • 2
  • 6
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,606
  • 1
  • 17
  • 26
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
  • 504
  • 6
  • 9
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
  • 667
  • 7
  • 8
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
  • 428
  • 4
  • 12
0

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

C:\Users\{userName}\node_modules\.bin
Magiczne
  • 1,586
  • 2
  • 15
  • 23
0
yarn expo start

Worked for me.

0

npx create-expo-app project-name

Arijit das
  • 69
  • 8