cli: `npx react-native init AwesomeProject` not working
➜ npx react-native init AwesomeProject2
###### ######
### #### #### ###
## ### ### ##
## #### ##
## #### ##
## ## ## ##
## ### ### ##
## ######################## ##
###### ### ### ######
### ## ## ## ## ###
### ## ### #### ### ## ###
## #### ######## #### ##
## ### ########## ### ##
## #### ######## #### ##
### ## ### #### ### ## ###
### ## ## ## ## ###
###### ### ### ######
## ######################## ##
## ### ### ##
## ## ## ##
## #### ##
## #### ##
## ### ### ##
### #### #### ###
###### ######
Welcome to React Native!
Learn once, write anywhere
✔ Downloading template
✖ Copying template
error Error: Couldn't find the "/var/folders/w5/bsw5vt490q78cyx2_h42ldtw0000gn/T/rncli-init-template-nzsCCY/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’m on Mac OS and don’t have the react-native
cli installed globally.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 40 (22 by maintainers)
@chenweigh I was also receiving similar error as below when running
npx react-native init MyAwesomeApp --template react-native-template-typescript
:Replacing
npx react-native
withnpx react-native@latest
solved it for me.Running
sudo npx react-native init AwesomeProject2
made it work. The download too way longer than before, so I’m guessing that it could not stream the download into the destination correctly.Obviously running as sudo has implications, but writing down my stream of thoughts as I debug this may be helpful to others.
chen@chen ~ % npx react-native init AwesomeProject
Need to install the following packages: react-native Ok to proceed? (y) y npm ERR! code ENOTEMPTY npm ERR! syscall rename npm ERR! path /Users/chen/.npm/_npx/7930a8670f922cdb/node_modules/react-native npm ERR! dest /Users/chen/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-JAoXw5Fv npm ERR! errno -66 npm ERR! ENOTEMPTY: directory not empty, rename ‘/Users/chen/.npm/_npx/7930a8670f922cdb/node_modules/react-native’ -> ‘/Users/chen/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-JAoXw5Fv’
npm ERR! A complete log of this run can be found in: npm ERR! /Users/chen/.npm/_logs/2022-01-26T10_18_02_465Z-debug.log
How to fix ?
In Windows 10 doesn’t work.
Cc @Esemesek. I think we could do init, just need to figure out something that works with yarn and npm 😃
The line that is failing is the step that creates the template. The step that creates the template runs:
yarn add react-native@latest
Maybe it’s something with permissions? We’ve seen a few users having similar issues and reasons were varying. We can’t really reproduce it ourselves. If you could debug this (clone this repo and follow CONTRIBUTING.md instructions), we’d be thankful for your help