unable to create react app with typescript

Viewed 360

I'm trying to create new react new app with typescript with the command

npx react-native init myApp --version 0.68.2 --template react-native-template-typescript

and I'm getting an error

error An unexpected error occurred: "https://registry.npm.taobao.org/react-native-template-react-native-template-typescript: [NOT_FOUND] react-native-template-react-native-template-typescript not found".

enter image description here

node version: v16.10.0

npm version:7.24.0

what I already tried to do

  • run with different way:

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

  • npm uninstall -g react-native-cli
  • npm i -g @react-native-community/cli
  • yarn remove global react-native-cli

nothing helped to solve this issue.

3 Answers

From the screenshot it seems like the template name is being picked up incorrectly for some reason

it should be looking for https://registry.npmmirror.com/react-native-template-typescript instead of https://registry.npmmirror.com/react-native-template-react-native-template-typescript

Can you try

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

Since the taobao npm has been moved to npmmirror. Reference

Use:

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

(w/o a version tag)

can you try this line

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

it should work to you

Related