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
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容