0
votes

I'm trying to run a new react native project but I'm getting the same problem over and over:
-bash: react-native: command not found.

I tried to solve the problem trough other post like this: react-native: command not found But I'm still getting the same error.

I followed all the steps provided by the React Native page (https://facebook.github.io/react-native/docs/getting-started), and I ended up with these info:

1 npm  -version         6.4.1
2 brew -version         Homebrew 2.1.1
3 brew info watchman    stable 4.9.0 
4 brew info node        stable 12.1.0
5 echo $PATH:

/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/(myname)/Library/Android/sdk/emulator:/Users/(myname)/Library/Android/sdk/tools:/Users/(myname)/Library/Android/sdk/tools/bin:/Users/(myname)/Library/Android/sdk/platform-tools:/Users/(myname)/Library/Android/sdk/tools/bin

if I type in: npm install -g react-native-cli

I get:

/Users/(myname)/.npm-global/bin/react-native -> /Users/(myname)/.npm-global/lib/node_modules/react-native-cli/index.js
+ [email protected]
updated 1 package in 3.653s

1
This looks exactly like the situation in the question you linked to. If you really tried all the answers there, please edit your question to show how each of them failed. (That is to say, I'm pretty sure you'll find the answer there. And we can't walk you through trying them all.)tripleee

1 Answers

0
votes

command not found means exactly that - the command you tried to execute (react-native) isn't found in any of the directories listed in your PATH variable.

Figure out where react-native is installed and either call it with a full path to the executable or add the directory to your PATH.

Based on this from your question:

5 echo $PATH:
/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/(myname)/Library/Android/sdk/emulator:/Users/(myname)/Library/Android/sdk/tools:/Users/(myname)/Library/Android/sdk/tools/bin:/Users/(myname)/Library/Android/sdk/platform-tools:/Users/(myname)/Library/Android/sdk/tools/bin

My best guess is that during installation you were following instructions that said to put (myname) somewhere and you literally entered the string (myname) instead of entering your actual login name.