react-native init template.config?
React Native version:
System:
OS: Windows 10
CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Memory: 16.77 GB / 31.93 GB
Binaries:
Node: 10.16.3 - C:\Program Files\nodejs\node.EXE
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
Steps To Reproduce
1.npm i -g @react-native-community/cli
2.react-native init MyApp
Describe what you expected to happen:
Tried to init with react-native globally installed. It seems to be attempting to download the template and attempting to copy it from my temp directory even though I see that file sitting in the global node_modules/react-native directory. I am using nvm to manage my node versions if that matters. I have used powershell, gitbash, and cmd all result the same with even with run as admin. I tried using npx but that resulted also in the same way
- Downloading template
√ Downloading template
- Copying template
× Copying template
error Error: Cannot find module 'C:\Users\Greg\AppData\Local\Temp\rncli-init-template-aaH8ON\node_modules\react-native\template.config'
D:\workspace>npm list -g --depth=0
C:\Program Files\nodejs
+-- @react-native-community/[email protected]
+-- [email protected]
`-- UNMET PEER DEPENDENCY react-native@^0.60.0
npm ERR! peer dep missing: react-native@^0.60.0, required by @react-native-community/[email protected]
I did google around and found other post about using --template and using the @next but still similar problems. Though I was not interested in using typescript so that wouldnt have been ideal.
I do want to note, I do not want to use my own template, I just want to init a project with whatever the cli provides.
I already filed a bug here https://github.com/facebook/react-native/issues/26443 but they said to come here
Please don't install the @react-native-community/cli globally. We use a temp directory to store the downloaded template there, copy to your desired directory and then remove it. Can you try with verbose flag for more information?
npx @react-native-community/cli init MyApp --verbose
D:\workspace>npx @react-native-community/cli init MyApp --verbose
###### ######
### #### #### ###
## ### ### ##
## #### ##
## #### ##
## ## ## ##
## ### ### ##
## ######################## ##
###### ### ### ######
### ## ## ## ## ###
### ## ### #### ### ## ###
## #### ######## #### ##
## ### ########## ### ##
## #### ######## #### ##
### ## ### #### ### ## ###
### ## ## ## ## ###
###### ### ### ######
## ######################## ##
## ### ### ##
## ## ## ##
## #### ##
## #### ##
## ### ### ##
### #### #### ###
###### ######
Welcome to React Native!
Learn Once Write Anywhere
debug Installing template from react-native@latest
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\Greg\node_modules\fsevents\node_modules'
npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ [email protected]
updated 1 package and audited 65699 packages in 24.897s
found 0 vulnerabilities
debug Getting config from C:\Users\Greg\AppData\Local\Temp\rncli-init-template-lVRhhh\node_modules\react-native\template.config.js
error Error: Cannot find module 'C:\Users\Greg\AppData\Local\Temp\rncli-init-template-lVRhhh\node_modules\react-native\template.config'
D:\workspace>
Do like to add I ran the above command with run as admin
Believe I have a similar issue. Attempting to follow the Getting Started guide results in the below error
npx react-native init MyFirstProject --verbose
debug Initializing new project
debug Installing template from react-native@latest
npm WARN deprecated [email protected]: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetching binaries from AWS, smaller package size
npm WARN deprecated [email protected]: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN [email protected] requires a peer of @types/react@^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of core-js@^3.1.4 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ [email protected]
updated 1 package and audited 67419 packages in 18.846s
found 6 vulnerabilities (4 low, 2 critical)
run `npm audit fix` to fix them, or `npm audit` for details
debug Getting config from C:\Users\slocke\AppData\Local\Temp\rncli-init-template-19jr1M\node_modules\react-native\template.config.js
error Error: Cannot find module 'C:\Users\slocke\AppData\Local\Temp\rncli-init-template-19jr1M\node_modules\react-native\template.config'
Require stack:
- C:\Users\slocke\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\init\template.js
- C:\Users\slocke\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\init\init.js
- C:\Users\slocke\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\init\index.js
- C:\Users\slocke\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\index.js
- C:\Users\slocke\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js
- C:\Users\slocke\node_modules\react-native\cli.js
I've gotten around this issue by using yarn to install react-native-cli globally
I've gotten around this issue by using yarn to install react-native-cli globally
si finally u used yarn to install. now, i'm facing the same problem with u. pls give me advice
Likely fixed by https://github.com/react-native-community/cli/pull/1077, we'll release it tomorrow
i faced the same issue but was resolved by using: npx react-native init ProjectName --npm
I'm facing these errors when I run command (npx react-native init AwesomeProject) . . . Downloading template error Error: Command failed: npm install --save --save-exact react-native@latest npm ERR! Windows_NT 10.0.18363 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\lenovo\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "--save" "--save-exact" "react-native@latest" npm ERR! node v14.15.1 npm ERR! npm v4.0.0
npm ERR! cb.apply is not a function npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request: npm ERR! C:\Users\lenovo\AppData\Local\Temp\rncli-init-template-O81d4q\npm-debug.log