4

I'm new to expo-cli and keep running into this on the terminal

expo init myproject
-bash: expo: command not found

First, I tried uninstall and installing via

sudo npm uninstall -g expo-cli && sudo npm i -g expo-cli
+ expo-cli@2.6.14

Second, I checked nodejs to see what version it was running on:

node -v
v10.15.0
npm -v
6.4.1

Third, I tried to see if it was an environment issue and adding a path via:

sudo vim ~/.bash_profile

inserting the following to the end:

# NPM global installs
export PATH=$PATH:~/.npm-global/bin

Did not solve the issue.

Etep
  • 2,721
  • 4
  • 17
  • 28
  • There is no need to use `sudo` to edit your own files. It is even wrong to use `sudo` to edit any file that is not a system configuration file (and nothing inside `~` is a system configuration file). It is correct that you added the path in `.bash_profile` but it doesn't have any effect now; this file is read on the next login. You have to either run it inside the current shell (`. ~/.bash_profile`) or update the value of `PATH` in memory (run the `PATH=...` line directly on the shell prompt). – axiac Jan 18 '19 at 06:31
  • @axiac so I tried updating the path directly on the current shell and it still doesn't recognize `expo`. I also tried `npm install expo-cli` directly on to my folder and updating the path, but that also failed... – Etep Jan 18 '19 at 22:47
  • 1
    Hi @PeteKang try it by react-native-cli instead of expo-cli – Anirban iOS Apr 04 '19 at 19:42
  • @PeteKang were you able to fix this? I'm having the same problem – AJT Oct 26 '19 at 18:43
  • @AT92 I ended up using react-native-cli – Etep Oct 29 '19 at 21:12
  • Can you check this, I have already answered: https://stackoverflow.com/questions/62971258/expo-cli-installed-but-when-running-any-expo-command-i-get-zsh-command-not-fou/64170054#64170054 – Chanrithisak Phok Oct 02 '20 at 11:22

2 Answers2

2

at firs do this:

npm install expo-cli

then it installed run this command:

npm install expo-cli --global

it worked for me , and i hope it works for you too ;)

Amir
  • 21
  • 2
0

First off, I am not going to take credit, This issue is was solved a long time ago and it is quite easy to solve, although not permanently yet.

So it is said that it is an issue with the environment, where as the device you're using need to know where the programmes are.

-Check if /users/me/.npm-global/bin by running: echo $PATH -It is isn't run export PATH=$PATH:~/.npm-global/bin -After that you should be good to get back to the shell

source ~/.bash_profilez

Like I said am not taking credit for this. Here is where i found our life saver;

Ole Pannier
  • 3,208
  • 9
  • 22
  • 33
5thfader
  • 52
  • 5