运行react-native run-ios时出错。错误:找不到模块“metro-config”

Dee*_*hav 4 react-native react-native-ios

我正在使用react-native run-is命令通过终端运行React-native项目。我想在模拟器中运行它。首先我运行 npm install ,然后运行 ​​react-native run-ios 。它显示错误

错误:找不到模块“metro-config”需要堆栈: - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/util/Config.js - /Users/tribond/Projects/JustHelper/ justhelper2/node_modules/react-native/local-cli/core/index.js - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/cliEntry.js - /Users/tribond/Projects/ JustHelper/justhelper2/node_modules/react-native/local-cli/cli.js - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/cli.js - /usr/local/lib/node_modules/react-本机-cli/index.js

hon*_*lop 11

您似乎没有Metro-config安装模块。安装此模块。

npm i metro-config --save-dev
Run Code Online (Sandbox Code Playgroud)

  • @Carlo 使用 npm install @react-native/metro-config --save-dev 代替 (2认同)