Berry Blue
Berry Blue

Reputation: 16482

Setting up React Native on Mac

I'm trying to install React Native on Mac but I'm not able to get past the first step.

npm install -g expo-cli

This seems to work but when I run the next step expo init AwesomeProject I'm getting this error.

-bash: expo: command not found

I also do not have a .npm-global folder. I'm running npm 6.13.4 on Mac OS X 10.15.2.

Upvotes: 0

Views: 568

Answers (1)

Sayuri Mizuguchi
Sayuri Mizuguchi

Reputation: 5330

This might be a local environment issue.

Your computer should know where to look for the commands you're using, it's likely that your mac is not looking for the correct folder.

In order to expo command works, you must have /Users/yourUser/.npm-global/bin in your $PATH commands.

  • Open your global bash_profile file vim ~/.bash_profile.

  • add export PATH=$PATH:~/.npm-global/bin.

Save the changes, and right after in your command line:

  • source ~/.bash_profile

Now you can try the command again!

Important Note: .bash_profile will run only on login shells. For non-login shells, you would need to create or edit .bashrc with this line above.

Upvotes: 2

Related Questions