Reputation: 261
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
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
Reputation: 590
You should try npx expo init <your_app_name>
to test.
It worked for me.
Upvotes: 29
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
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
Reputation: 887
I solved it by putting this in my PATH
environment variable / user variable:
C:\Users\{userName}\node_modules\.bin
Upvotes: 0
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
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
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
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
Reputation: 17010
This suggested 3 steps solution worked for me:
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.
Open up ~/.bash_profile
then add the following line to the bottom: export PATH=$PATH:~/.npm-global/bin
Finally, back in the shell, type: source ~/.bash_profile
Hopefully that will have fixed your problem.
Upvotes: 22
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