15

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.

3
  • I have found the solution. Here is the solution for react-native cli. Replace react-native with expo (exp). Commented Aug 13, 2018 at 13:53
  • 1
    Does this answer your question? react-native: command not found
    – Nimantha
    Commented Jun 23, 2022 at 2:27
  • try export PATH=$PATH:node_modules/.bin
    – lkahtz
    Commented Dec 7, 2022 at 8:01

14 Answers 14

28

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

It worked for me.

1
  • 7
    sometimes things work and your don't even care why Commented Sep 13, 2021 at 15:14
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.

0
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

1
  • on mac it says Unknown command: "bin"
    – art_hq
    Commented May 12 at 12:02
13

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
2
  • Better change access permissions to your dir with global node modules by chmod / chown. Even better install node by nvm.
    – Daniel
    Commented Dec 27, 2021 at 10:16
  • sudo npm install --global expo-cli --worked for me Commented Aug 22, 2022 at 9:26
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.

1
  • 1
    Only a working solution for me! Search a lot, tried a lot. This is the only fix. Thanks!!! Commented Jan 9, 2020 at 11:49
6

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).

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.

1

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.

0

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

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.

0

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

C:\Users\{userName}\node_modules\.bin
0
yarn expo start

Worked for me.

0

npx create-expo-app project-name

0

Use

npx create-expo-app <appname> 

instead and it will work.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Mar 4 at 10:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.