loungeonbench loungeonbench - 2 months ago 14
Node.js Question

-bash: react-native: command not found

I have successfully installed brew, node 4.0+, watchman and flow, and I received the following when I do npm install -g react-native-cli:

/Users/home/.node/bin/react-native -> /Users/home/.node/lib/node_modules/react-native-cli/index.js
react-native-cli@0.1.5 /Users/home/.node/lib/node_modules/react-native-cli
└── prompt@0.2.14 (revalidator@0.1.8, pkginfo@0.3.1, read@1.0.7, winston@0.8.3, utile@0.2.1)


So I assume react-native-cli has been successfully installed as well. However when I run react-native, it says

-bash: react-native: command not found


My node version is 4.2.1, watchman 3.9, brew 0.9.5 (git 7ed6) and npm 2.14.7

Answer

You have to make sure /usr/local/share/npm/bin is in your PATH to use binaries installed with npm.

Add the following to your ~/.bashrc:

export PATH="/usr/local/share/npm/bin:$PATH"

And reload your shell session.