react-native - 运行应用程序时 react native (root 丢失)

标签 react-native

当我过去使用 react-native run-android 运行这个应用程序时创建了 react native 应用程序之后,我收到错误,因为 root 丢失

error Option "--root" is missing. Run CLI with --verbose flag for more details. Error: Option "--root" is missing at C:\Users\Mayuri\AppData\Roaming\npm\node_modules\react-native\node_modules@react-native-community\cli\build\tools\assertRequiredOptions.js:51:13


enter image description here

最佳答案

如果您使用的是最新版本的 react-native 64 并且 npm 大于 5.2,则需要使用 npx 命令执行包,而不是运行

react-native run-android 
npx react-native run-android

关于react-native - 运行应用程序时 react native (root 丢失),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66763925/

相关文章:

javascript - 仅更新被单击元素的状态

javascript - React-Native 选择器警告

javascript - 如何在没有 lambda 函数的情况下通过单个处理程序在 React Native 中处理几个 TextInput?

ios - 如何修复 pod 安装错误 glog 太旧或缺少 Windows 10 中的 native ios

android - Linking.getInitialURL() 在用于深度链接后未被清除

react-native - React Native [网络错误] : TypeError: Network request failed using Apollo Client

reactjs - 原生应用中的 ffmpeg、ffmpeg wasm 和 ffmpeg 有什么区别?

javascript - 在 react 或 react-native 中处理渲染函数中的多个返回的正确方法是什么

ios - 类型错误 : undefined is not an object (evaluating '_rxjs.queueScheduler.constructor' )

javascript - React native : Component not defined? 无法导入?