I'm trying to create a new application in React Native using react-native init MyApp
But I got this error:
√ Downloading template
× Copying template
error Error: Cannot find module 'C:\Users\Emre\AppData\Local\Temp\rncli-init-template-hNGjwo\node_modules\react-native\template.config'
What I've tried:
npm install -g react-native-cli
then
react-native init MyApp
What do I need to do to solve this problem?
To solve the "Cannot find module react or its corresponding type declarations" error, install the module and its type definitions by running the commands npm install react and npm i --save-dev @types/react . Copied! Now you should be able to import the react library with the following line of code.
To solve the error "Cannot find module 'react/jsx-runtime' or its corresponding type declarations", make sure to install the typings for react running the command npm install --save-dev @types/react@latest @types/react-dom@latest and restart your dev server. Copied!
yarn global add @react-native-community/[email protected]
then react-native init MyApp
worked for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With