2
votes

I am trying to import react-native module into my react app. When I start my app server using 'npm start', I get the following error :

Module not found: Can't resolve 'react-native'

I have done following steps:

  • cleaned npm cache using 'npm cache verify'
  • deleted node_modules
  • rerun the command 'npm install'
  • checked package.json file if it has react-native dependency listed

Nothing worked for me. Please help!!

1
@Think-Twice but I am already using npm. Wouldn't mixing package managers mess up everything? Please advise. - powerranger
npm works fine, you don't need Yarn. After you npm install, can you verify if ./node_modules/react-native exists? - Matthew Herbst
Sorry are you using Atom? - Hemadri Dasari
@MatthewHerbst yes it does. - powerranger
@Think-Twice I am doing this on windows, considering you are referring to os - powerranger

1 Answers

0
votes

Try to recreate your app using the react native CLI. Use the command npm install -g react-native-cli, then use react-native init ProjectName and after that try to run the project.

If you cannot create a new app for any reason, try to install the react-native-cli anyway and try to run react-native run-android or react-native run-ios (depending on the plataform you want to use as a tester_ instead of npm start.