首页 > 解决方案 > 运行 react-native run-ios 时出错。错误:找不到模块“metro-config”

问题描述

我正在使用 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

标签: react-nativereact-native-ios

解决方案


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

npm i metro-config --save-dev

推荐阅读