YAC*_*INE 7 typescript react-native
卸载后,react-native-cli
我运行此命令以使用打字稿模板启动 RN 项目:
npx react-native init MyApp --template react-native-template-typescript
Run Code Online (Sandbox Code Playgroud)
但我收到了这个错误:
警告 jest > jest-cli > jest-config > jest-environment-jsdom > jsdom
left-pad@1.3.0: 使用 String.prototype.padStart() 错误发生意外错误:“ https://registry.yarnpkg.com/react-native-template-react-native-template-typescript : Not found” .info 如果您认为这是一个错误,请打开.....
[1/2] Removing module react-native-template-react-native-template-typescript...
error This module is not specified in a package .json 文件。
信息 访问https://yarnpkg.com/en/docs/cli/remove获取有关此命令的文档。警告无法清理 node_modules/react-native-template-react-native-template-typescript 中的模板临时文件。这不是严重错误,您可以处理您的应用程序。
(node:8548) UnhandledPromiseRejectionWarning: 错误: 命令失败: yarn add react-native-template-react-native-template-typescript
删除旧的 react-native-cli
npm uninstall -g react-native-cli
从“react-native-community”安装新的:
npm i -g @react-native-community/cli
之后,使用以下命令初始化项目:
npx react-native init MyApp --template react-native-template-typescript
这也将有所帮助,--ignore-existing
npx --ignore-existing react-native init MyApp --template react-native-template-typescript
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
20051 次 |
最近记录: |