error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-template-react-nat...

ts+react native
执行ts模板RN工程初始化命令报错

npx react-native init AwesomeTSProject --template react-native-template-typescript

error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-template-react-native-template-typescript: Not found"

执行命令报错

参考文章链接
原因是脚手架版本是js版本,需要从社区安装新版支持ts的脚手架

npm uninstall -g react-native-cli

Install new one from "react-native-community":

npm i -g @react-native-community/cli

after that, init the Project with:

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

你可能感兴趣的:(error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-template-react-nat...)