react-native init command won't install TS template correctly
See original GitHub issueDescription
I am setting up a new project according to doc https://reactnative.dev/docs/environment-setup but somehow Typescript template name is changed (log shows npm ERR! 404 Not Found - GET https://registry.npmjs.org/react-native-template-react-native-template-typescript - Not found
) and basic JS version is installed instead.
npx react-native init rnhuawei --template react-native-template-typescript
This will walk you through creating a new React Native project in C:\sadl\rnhuawei
'yarn' is not recognized as an internal or external command,
operable program or batch file.
Installing react-native...
Consider installing yarn to make this faster: https://yarnpkg.com
npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated core-js@2.6.12: core-js@<3 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 deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
> core-js@2.6.12 postinstall C:\sadl\rnhuawei\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN react-native@0.63.4 requires a peer of react@16.13.1 but none is installed. You must install peer dependencies yourself.
npm WARN use-subscription@1.5.1 requires a peer of react@^16.8.0 || ^17.0.0 but none is installed. You must install peer dependencies yourself.
+ react-native@0.63.4
added 730 packages from 409 contributors and audited 731 packages in 29.365s
14 packages are looking for funding
run `npm fund` for details
found 3 low severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
info Setting up new React Native app in C:\sadl\rnhuawei
info Fetching template react-native-template-react-native-template-typescript...
(node:6112) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/react-native-template-react-native-template-typescript - Not found
npm ERR! 404
npm ERR! 404 'react-native-template-react-native-template-typescript@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
React Native version:
> react-native info
info Fetching system and libraries information...
(node:27984) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
OS: Windows 10 10.0.19042
CPU: (16) x64 Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
Memory: 13.32 GB / 31.78 GB
Binaries:
Node: 14.15.5 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 6.14.11 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 28, 29, 30
Build Tools: 26.0.3, 27.0.3, 28.0.3, 29.0.2, 30.0.3
System Images: android-26 | Android Wear Intel x86 Atom, android-28 | China version of Wear OS Intel x86 Atom, android-29 | Automotive with Play Store Intel x86 Atom, android-29 | Android TV Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom
Android NDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
Versions: 10.0.17763.0, 10.0.18362.0, 10.0.19041.0
IDEs:
Android Studio: Not Found
Visual Studio: Not Found
Languages:
Java: 1.8.0_211
Python: 3.9.1
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.4 => 0.63.4
react-native-windows: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- init new ts project
Expected Results
it should look for the correct template name on GH - which still exists https://github.com/react-native-community/react-native-template-typescript
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5
Top Results From Across the Web
Using TypeScript - React Native
If you're starting a new project, there are a few different ways to get started. You can use the TypeScript template: npx react-native...
Read more >react-native-typescript-transformer | Yarn - Package Manager
If you are starting a new React Native project, you can initialize the project with this command: react-native init MyAwesomeProject --template typescript.
Read more >ReactDOM – React
If this component has been mounted into the DOM, this returns the corresponding native browser DOM element. This method is useful for reading...
Read more >react-native-code-push - npm
By default, CodePush will check for updates on every app start. If an update is available, it will be silently downloaded, and installed...
Read more >Creating a TypeScript React Application with Vite
npm init vite@2.8.0 vite-number-conversion --template react-ts ... Run the following command to install the additional dependency.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Update: by looking @Simek’s comment at https://github.com/facebook/react-native-website/pull/2544 and checking at the version I have, I was stuck on
react-native-cli: 2.0.1
. By removing it and usingnpx
instead it works fine.@dkocich same here, and this is why: https://github.com/react-native-community/cli/blob/5ec3fcf3a623b5a9faef050b72eab3778f241761/packages/cli/src/tools/generator/templates.ts#L56-L64
It works fine by removing
react-native-template
from the--template
option.