Bobby Zhang
Bobby Zhang

Reputation: 261

"exp: command not found" How do I add expo cli to path?

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.

Upvotes: 16

Views: 92552

Answers (15)

Luther
Luther

Reputation: 280

Ran into a similar but fixed it by prefixing 'npx' before the expo command.

For example:

npx expo install expo-linear-gradient

Upvotes: 0

Sufyan Khan
Sufyan Khan

Reputation: 1

Use

npx create-expo-app <appname> 

instead and it will work.

Upvotes: 0

Arijit das
Arijit das

Reputation: 81

npx create-expo-app project-name

Upvotes: 0

Ohiare Nathaniel
Ohiare Nathaniel

Reputation: 36

yarn expo start

Worked for me.

Upvotes: 0

0xcuonghx
0xcuonghx

Reputation: 590

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

It worked for me.

Upvotes: 29

Sreyorn Len
Sreyorn Len

Reputation: 163

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

Upvotes: 14

hirdesh tomar
hirdesh tomar

Reputation: 329

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

Upvotes: 22

Mohammed alsheikh
Mohammed alsheikh

Reputation: 887

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

C:\Users\{userName}\node_modules\.bin

Upvotes: 0

shahriarpshuvo
shahriarpshuvo

Reputation: 464

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.

Upvotes: 0

Pascal Nitcheu
Pascal Nitcheu

Reputation: 799

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

Upvotes: 0

CodeYute
CodeYute

Reputation: 74

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.

Upvotes: 1

TLC
TLC

Reputation: 381

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.

Upvotes: 11

Bill Zelenko
Bill Zelenko

Reputation: 2858

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

Upvotes: 6

numediaweb
numediaweb

Reputation: 17010

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.

Upvotes: 22

flunder
flunder

Reputation: 521

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.

Upvotes: 2

Related Questions