Command
npx react-native@latest init AwesomeProject
Output
✔ Downloading template
✖ Copying template
error Error: Couldn't find the "/var/folders/8x/y10dxy554tzb5d5d2tv_rffh0000gn/T/rncli-init-template-c131XZ/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.
Error: Error: Couldn't find the "/var/folders/8x/y10dxy554tzb5d5d2tv_rffh0000gn/T/rncli-init-template-c131XZ/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
at createFromTemplate (/Users/rmunoz/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/commands/init/init.js:131:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.initialize [as func] (/Users/rmunoz/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/commands/init/init.js:184:3)
at async Command.handleAction (/Users/rmunoz/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/index.js:106:9)
info Run CLI with --verbose flag for more details.
I checked the /var/ directory and /T/rncli-init-template-c131XZ/node_modules/react-native/template.config.js does NOT exist. I tried looking online for the template to just make it myself but i could not find it, i don't really even know where to look.
I followed the github link but i obviously do not want to create a custom template.
I did follow the documentation to install xcode cli tools and the correct version of ruby 2.7.6
There is a warning at the top of the instructions you're following:
Note: If you have both
yarn
andnpm
installed on your machine, React Native CLI will always try to useyarn
, so even if you usenpx
utility, onlyreact-native
executable will be installed usingnpm
and the rest of the work will be delegated toyarn
. You can force usage ofnpm
adding--pm npm
flag to the command.
You need to re-run your command with --pm npm
:
npx react-native@latest init AwesomeProject --pm npm
But for modern versions (late 2024) the init
command was deprecated and as of December 30th 2024 is removed entirely. It reports:
- Switch to
npx @react-native-community/cli init
for the identical behavior.
So the new command is:
npx @react-native-community/cli init AwesomeProject --pm npm