C:\Users\User>npx react-native info
info Fetching system and libraries information...
System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
Memory: 4.63 GB / 15.94 GB
Binaries:
Node: 13.7.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.13.6 - C:\Program Files\nodejs\npm.CMD
SDKs:
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.3, 25.0.3, 26.0.2, 26.0.3, 27.0.0, 27.0.3, 28.0.2, 28.0.3, 29.0.0, 29.0.2, 29.0.3
System Images: android-23 | Android TV ARM EABI v7a, android-23 | Android TV Intel x86 Atom, android-23 | Android Wear ARM EABI v7a, android-23 | Android Wear Intel x86 Atom, android-23 | ARM EABI v7a, android-23 | Intel x86 Atom, android-23 | Intel x86 Atom_64, android-23 | Google APIs ARM EABI v7a, android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom
Android NDK: 21.0.6113669
npmPackages:
react-native: ^0.61.5 => 0.61.5
Trying to init a new project does not work
Following this instruction page
'https://facebook.github.io/react-native/docs/getting-started' and selecting 'React Native CLI Quickstart '
D:\CodeTests>npx @react-native-community/cli init AwesomeProject
###### ######
### #### #### ###
## ### ### ##
## #### ##
## #### ##
## ## ## ##
## ### ### ##
## ######################## ##
###### ### ### ######
### ## ## ## ## ###
### ## ### #### ### ## ###
## #### ######## #### ##
## ### ########## ### ##
## #### ######## #### ##
### ## ### #### ### ## ###
### ## ## ## ## ###
###### ### ### ######
## ######################## ##
## ### ### ##
## ## ## ##
## #### ##
## #### ##
## ### ### ##
### #### #### ###
###### ######
Welcome to React Native!
Learn once, write anywhere
√ Downloading template
× Copying template
error Error: Couldn't find the "C:\Users\User\AppData\Local\Temp\rncli-init-template-Yt4wkn\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
I am not using anything but the default and so the error about custom-templates seems like a swing and a miss.
The folder/file 'rncli-init-template-Yt4wkn\node_modules\react-native\template.config.js' does not exist.
Presumably this is working for other people but
npx @react-native-community/cli init AwesomeProject
never works for me now.
It wouldn't exist anyway, because we clean it up in either scenario. Does running with --verbose flag help? Also, can you use a local version of the CLI and debug what's happening? It's possible that the permissions are wrong and the file cannot be read.
so i did
D:\CodeTests>yarn global add @react-native-community/cli
Then inited a new project with verbose and go this.
D:\CodeTests>react-native init fooer --verbose
debug We couldn't find a package.json in your project. Are you sure you are running it inside a React Native project?
debug Failed to load configuration of your project. Only a subset of commands will be available.
debug Initializing new project
###### ######
### #### #### ###
## ### ### ##
## #### ##
## #### ##
## ## ## ##
## ### ### ##
## ######################## ##
###### ### ### ######
### ## ## ## ## ###
### ## ### #### ### ## ###
## #### ######## #### ##
## ### ########## ### ##
## #### ######## #### ##
### ## ### #### ### ## ###
### ## ## ## ## ###
###### ### ### ######
## ######################## ##
## ### ### ##
## ## ## ##
## #### ##
## #### ##
## ### ### ##
### #### #### ###
###### ######
Welcome to React Native!
Learn once, write anywhere
debug Installing template from react-native@latest
yarn add v1.22.0
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-native > [email protected]" has unmet peer dependency "@babel/core@*".
warning " > [email protected]" has unmet peer dependency "[email protected]".
[4/4] Building fresh packages...
warning No license field
success Saved 1 new dependency.
info Direct dependencies
└─ [email protected]
info All dependencies
└─ [email protected]
Done in 3.76s.
debug Getting config from C:\Users\User\AppData\Local\Temp\rncli-init-template-Wh0o8l\node_modules\react-native\template.config.js
error Error: Couldn't find the "C:\Users\User\AppData\Local\Temp\rncli-init-template-Wh0o8l\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
unsure how to debug this. any guides?
Downloading the repo locally, following CONTRIBUTING.md guide to run watch script and run init through the local binary (like node ../rncli/packages/cli/build init) and fiddle with the source. I don't have windows machine to test, so won't be able to do it myself, hope you'll find what's wrong :)
Check if your "C:\Users\YourUser" has a folder named "node_modules" and/or a file named "package.json".
If you have them create a new folder (name it whatever you want) and move "node_modules" and/or "package.json" to that new folder.
Exit the folder and try to init the project again.
@aidanw I just noticed. Please don't add any packages related to RN/CLI globally. Run yarn global remove @react-native-community/cli just in case as well, it's not meant to be installed globally.
Thanks @Alph4Four's aggressive solution cleared out whatever the snarl was.
Check if your "C:\Users\YourUser" has a folder named "node_modules" and/or a file named "package.json".
If you have them create a new folder (name it whatever you want) and move "node_modules" and/or "package.json" to that new folder.
Exit the folder and try to init the project again.
It worked for me. Thank you!
Check if your "C:\Users\YourUser" has a folder named "node_modules" and/or a file named "package.json".
If you have them create a new folder (name it whatever you want) and move "node_modules" and/or "package.json" to that new folder.
Exit the folder and try to init the project again.
This works for me. Thankx
Most helpful comment
Check if your "C:\Users\YourUser" has a folder named "node_modules" and/or a file named "package.json".
If you have them create a new folder (name it whatever you want) and move "node_modules" and/or "package.json" to that new folder.
Exit the folder and try to init the project again.