Elian
Elian

Reputation: 11

Create App with React Native and typescript

I'm trying to create an app with React Native and TypeScript, but it's not working. I use the following commands:

npx react-native init MyApp --template react-native-template-typescript

And the log error:

Yarn version: 
  1.22.15

Node version: 
  16.10.0

Platform: 
  win32 x64

Trace: 
  Error: https://registry.yarnpkg.com/react-native-template-react-native-template-typescript: Not found
      at Request.params.callback [as _callback] (C:\Users\pc\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:66140:18)
      at Request.self.callback (C:\Users\pc\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:140885:22)
      at Request.emit (node:events:390:28)
      at Request.<anonymous> (C:\Users\pc\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:141857:10)
      at Request.emit (node:events:390:28)
      at IncomingMessage.<anonymous> (C:\Users\pc\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:141779:12)
      at Object.onceWrapper (node:events:509:28)
      at IncomingMessage.emit (node:events:402:35)
      at endReadableNT (node:internal/streams/readable:1343:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)

Upvotes: 0

Views: 1814

Answers (2)

Vijay
Vijay

Reputation: 39

You can try

npx [email protected] init MyTestApp --version 0.65 --template [email protected]

Upvotes: 0

Jonas
Jonas

Reputation: 41

you should first uninstall the previous react-native-cli to install the newest with the typescript features.

1- npm uninstall -g react-native-cli.

2- yarn global add @react-native-community/cli

3- react-native init MyApp --template react-native-template-typescript

Upvotes: 1

Related Questions