Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npx react-native init MyApp --template react-native-template-typescript does not work correctly #64

Closed
ajaymore opened this issue Sep 12, 2019 · 10 comments

Comments

@ajaymore
Copy link

Bug

Environment info

React native info output:

System:
    OS: macOS 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 1.15 GB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.6.0 - /usr/local/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 23, 25, 26, 27, 28
      Build Tools: 23.0.1, 23.0.3, 25.0.1, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.3
      System Images: android-27 | Google APIs Intel x86 Atom
      Android NDK: 19.2.5345600
  IDEs:
    Android Studio: 3.1 AI-173.4907809
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5 
  npmGlobalPackages:
    create-react-native-app: 1.0.0
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7

Library version: x.x.x

Steps To Reproduce

  1. After running command npx react-native init MyApp --template react-native-template-typescript I get below error in terminal

Screenshot 2019-09-12 at 6 27 53 PM

The installer is looking for package **react-native-template-react-native-template-typescript** which is not available.

  1. After removing react-native-template- & running command npx react-native init MyApp --template typescript I get below folder structure which is incorrect.

Screenshot 2019-09-12 at 6 30 00 PM

Typescript project is created inside template directory.
@schachris
Copy link

I got the same error... a week ago it was working correctly
probably a bug with the new 6.1.0 version?

@kosperera
Copy link

I get the same folder structure with new template.config.js file and it's confusing. Wonder which is the correct working folder. Can someone please shed some light?

@eugenemlee
Copy link

IMPORTANT STEP: Remove your globally installed react-native-cli:
npm uninstall -g react-native-cli

Then install using npx:
npx react-native init app --template react-native-template-typescript

@mrbrentkelly
Copy link
Contributor

Thank you @eugenemlee that worked for me 👍. I've submitted a PR which updates the README accordingly #65.

@ajaymore
Copy link
Author

ajaymore commented Sep 13, 2019

I was able to create a new project as described, it works pretty well. How do we run react-native run-android after doing npm uninstall -g react-native-cli

@eugenemlee
Copy link

@ajaymore use yarn react-native run-android or create a script in package.json

@ajaymore
Copy link
Author

@ajaymore use yarn react-native run-android or create a script in package.json

Screenshot 2019-09-13 at 5 57 48 PM

Something has gone wrong. I can't understand what.

@eugenemlee
Copy link

See here for the solution.

@ajaymore
Copy link
Author

Thank you @eugenemlee. Putting down all the steps for those who might visit this issue.

  1. Uninstall Global react-native-cli
npm uninstall -g react-native-cli
  1. Create The App with Typescript template
npx react-native init MyApp --template react-native-template-typescript
  1. Generate debug.keystore in android/app/ directory
keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
  1. Run below command to launch the app in emulator.
yarn react-native run-android

@ivanbtrujillo
Copy link

ivanbtrujillo commented Oct 12, 2019

@ajaymore use yarn react-native run-android or create a script in package.json

With npx:

npx react-native run-android 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants