Reactjs – Why doesn’t npm install react-native not work

npmreact-nativereactjs

I'm trying to install react-native through npm install --save react-native for my library so I can export a react component that uses View as a wrapper around it's children to be platform agnostic. When I try to import react-native it spews hundreds of lines saying that it can't resolve modules in react-native

eg

Error in ./~/react-native/Libraries/react-native/react-native.js
Module not found: Error: Cannot resolve module 'ActivityIndicator'

What's the best way to resolve this?

Best Answer

  1. You need to install react-native-cli first using npm install -g react-native-cli.
  2. Then start your project by hitting the following- react-native init YourProjectName

For detailed information, follow their guid!