React Native:无法解析模块fs

Unable to resolve module fs from /...mypath

尝试将节点模块导入我的本地应用程序时出现此错误。

该模块以这种方式使用“ fs”:

var fs = require('fs');
var list = JSON.parse(fs.readFileSync(__dirname + '/list.json', 'utf8'));
Mike Grabowski:

React Native应用程序不在Node.js环境中运行(打包程序仅使用它实际服务和编译您的应用程序包)。

由于您的应用程序在iPhone或Android上的JS VM中运行,因此访问文件系统的唯一方法是使用react-native-fs或任何其他使用桥接连接与平台特定的本机API进行通信的第三方模块。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

React Native无法解析模块

无法解析本地文件模块(React Native)

错误:无法解析模块`buffer` React Native

React Native Image 无法解析模块

React Native 错误:无法解析模块`./index`

React Native中的“无法解析模块路径”

无法解析模块(Expo,React Native)

无法解析模块“ react-native-reanimated”

react-native无法解析模块'warnOnce'

React-Native undefined 无法解析模块

React-Native-无法从node_modules / eslint / lib / cli-engine / cli-engine.js解析模块fs

React Native 错误“无法解析模块‘react-native’”

尝试在React Native中组织模块时无法解析模块

React Flow:无法解析模块react-native

React Native TypeScript:无法解析模块(但它存在)

React-native 无法在导入 js 文件时解析模块

如何使用react-native解决“无法解析模块...”错误?

错误:无法解析模块“ react-native-gesture-handler”

React Native:npm链接本地依赖关系,无法解析模块

React Native:捆绑失败-无法解析模块`AccessibilityInfo`

Twilio React Native-无法解析模块密码

错误:无法解析模块react-redux / native

react-native错误:无法解析模块AccessibilityInfo

react-native-community / CheckBox无法解析模块

React Native-无法解析模块`@ babel / runtime / helpers / interopRequireDefault`

无法从App.js解析(模块)-React Native

无法解析模块 ./SignIn In React Native 应用程序

无法从App.js解析模块-React Native

图像路径 react-native:无法解析模块