React Native --- 找不到模块 '@hapi/joi' 需要堆栈

Posted

技术标签:

【中文标题】React Native --- 找不到模块 \'@hapi/joi\' 需要堆栈【英文标题】:React Native --- Cannot find module '@hapi/joi' Require stackReact Native --- 找不到模块 '@hapi/joi' 需要堆栈 【发布时间】:2021-06-28 09:29:19 【问题描述】:

在我的 React-Native 项目中,我下载了带有 node 的 react-native-camera 和 react-native-qrcode-scanner 库来读取二维码,但是在运行应用程序时开始出现这样的错误。

节点:内部/模块/cjs/loader:926 抛出错误; ^

错误:找不到模块“@hapi/joi” 需要堆栈:

D:\React\LCapp\LCapp\node_modules@react-native-community\cli\build\tools\config\schema.js D:\React\LCapp\LCapp\node_modules@react-native-community\cli\build\tools\config\readConfigFromDisk.js D:\React\LCapp\LCapp\node_modules@react-native-community\cli\build\tools\config\index.js D:\React\LCapp\LCapp\node_modules@react-native-community\cli\build\commands\install\install.js D:\React\LCapp\LCapp\node_modules@react-native-community\cli\build\commands\index.js D:\React\LCapp\LCapp\node_modules@react-native-community\cli\build\index.js D:\React\LCapp\LCapp\node_modules@react-native-community\cli\build\bin.js 在 Function.Module._resolveFilename (节点:internal/modules/cjs/loader:923:15) 在 Function.Module._load (节点:internal/modules/cjs/loader:768:27) 在 Module.require (node:internal/modules/cjs/loader:995:19) 在需要(节点:内部/模块/cjs/helpers:92:18) 在 t (D:\React\LCapp\LCapp\node_modules@react-native-community\cli\build\tools\config\schema.js:9:40) 在对象。 (D:\React\LCapp\LCapp\node_modules@react-native-community\cli\build\tools\config\schema.js:28:17) 在 Module._compile (node:internal/modules/cjs/loader:1091:14) 在 Object.Module._extensions..js (node:internal/modules/cjs/loader:1120:10) 在 Module.load (node:internal/modules/cjs/loader:971:32) 在 Function.Module._load (node:internal/modules/cjs/loader:812:14) 代码:'MODULE_NOT_FOUND', 要求堆栈:[ 'D:\React\LCapp\LCapp\node_modules\@react-native-community\cli\build\tools\config\schema.js', 'D:\React\LCapp\LCapp\node_modules\@react-native-community\cli\build\tools\config\readConfigFromDisk.js', 'D:\React\LCapp\LCapp\node_modules\@react-native-community\cli\build\tools\config\index.js', 'D:\React\LCapp\LCapp\node_modules\@react-native-community\cli\build\commands\install\install.js', 'D:\React\LCapp\LCapp\node_modules\@react-native-community\cli\build\commands\index.js', 'D:\React\LCapp\LCapp\node_modules\@react-native-community\cli\build\index.js', 'D:\React\LCapp\LCapp\node_modules\@react-native-community\cli\build\bin.js' ]

【问题讨论】:

【参考方案1】:

你可以试试

纱线安装

【讨论】:

试了下还是一样

以上是关于React Native --- 找不到模块 '@hapi/joi' 需要堆栈的主要内容,如果未能解决你的问题,请参考以下文章

react-native init...找不到模块...\template.config

React Native iOS - 致命错误:找不到模块'GoogleMapsBase'

在本机 ios 中找不到模块“react-native-reanimated/plugin”

找不到相对于目录的预设“模块:metro-react-native-babel-preset”

React Native 无法 npx 初始化项目,找不到模块错误

react-native 捆绑失败:错误:找不到模块 /metro-react-native-babel-transformer/src/index.js