4

Error:

Error: Couldn't find the "C:\Users\Admin\AppData\Local\Temp\rncli-init-template-oScLDz\node_modules\react-native\template.config.js file inside "react-native" template. Please make sure the template is valid. Read more: https://github.com/react-native-community/cli/blob/master/docs/init.md#creating-custom-template

Screenshot:

enter image description here

3 Answers 3

7

I have tried with npm using and it worked.

npx react-native init YourAwesomeProject --npm

After that I have uninstalled yarn completely. Because you can install libraries using npm. So I have removed the yarn using

npm uninstall -g yarn
Sign up to request clarification or add additional context in comments.

2 Comments

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
this worked but can you please explain how? What is the difference between having this flag '--npm' and not having this.
2

You can try:

  • Remove the global react-native CLI: npm uninstall -g react-native-cli or yarn global remove react-native-cli

  • And run again npx react-native init YourAwesomeProject

    or

  • Run npx react-native-cli init YourAwesomeProject

Maybe these links can help:

https://github.com/react-native-community/cli#about

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

1 Comment

I never saw this type of error before. Since the other alternatives didn't work, try to install the react native CLI globally: yarn global add react-native-cli or npm i -g react-native-cli and run react-native init AwesomeProject
0

surely you have your root a file or folder .yarn/ package.json package-lock.json

Remove them and try again rm -rf .yarn/ package.json .yarn/ package-lock.json

1 Comment

I don't know why, but appending --npm fixed it. Never had to do that before.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.