3

I think I've broken my node/react-native/react PATHs/installation/links and since yesterday I'm trying to figure out what to do.

The errors are:

zsh: command not found: create-react-app
zsh: command not found: react-native

In my which node:

/usr/local/bin/node

My npm get prefix:

/Users/username/.npm-packages

My PATH is:

/Users/username/.rvm/gems/ruby-2.3.0/bin:/Users/username/.rvm/gems/ruby-2.3.0@global/bin:/Users/username/.rvm/rubies/ruby-2.3.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/username/.npm-packages:/usr/local/bin/node:/Users/username/.rvm/bin

EDIT:

My workaround was uninstalling all the NODE.JS installation

The following is the best way to completely uninstall node + npm:

  1. go to /usr/local/lib and delete any node and node_modules
  2. go to /usr/local/include and delete any node and node_modules directory
  3. if you installed with brew install node, then run brew uninstall node in your terminal
  4. check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
  5. go to /usr/local/bin and delete any node executable

You may need to do the additional instructions as well:

  1. sudo rm /usr/local/bin/npm
  2. sudo rm /usr/local/share/man/man1/node.1
  3. sudo rm /usr/local/lib/dtrace/node.d
  4. sudo rm -rf ~/.npm
  5. sudo rm -rf ~/.node-gyp
  6. sudo rm /opt/local/bin/node
  7. sudo rm /opt/local/include/node
  8. sudo rm -rf /opt/local/lib/node_modules
  9. sudo rm -rf /usr/local/include/node/
2
  • 3
    Have you tried running npm install -g react-native-cli again ? Commented Sep 25, 2016 at 20:17
  • Yes, but is not working yet: /Users/username/.npm-packages/bin/react-native -> /Users/username/.npm-packages/lib/node_modules/react-native-cli/index.js /Users/username/.npm-packages/lib └── [email protected] Commented Sep 25, 2016 at 20:30

2 Answers 2

0

Try this: npm -g install react-native OR npm i -g react-native-cli

for zsh error: npm install -g react-native-cli

0

Use npx to solve the error "create-react-app: command not found".

Example:

For React JS: npx create-react-app my-app

For React Native: npx react-native@latest init AwesomeProject

or install the package globally by running npm install -g create-react-app to be able to use the command without the npx prefix.

The fastest way to solve the error is to use the npx command.

Not the answer you're looking for? Browse other questions tagged or ask your own question.