Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "Can not find module ".../template.config" error in React Native

Tags:

react-native

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?

like image 933
Emre D. Avatar asked Sep 28 '19 09:09

Emre D.


People also ask

How to fix Cannot find module in react?

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.

Can't find module react or its corresponding type declarations?

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!


1 Answers

yarn global add @react-native-community/[email protected] then react-native init MyApp worked for me

like image 66
Emre D. Avatar answered Nov 10 '22 16:11

Emre D.