微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

博览会-根据需要反应本机文件系统错误

如何解决博览会-根据需要反应本机文件系统错误

我不需要react-native-fs,应用会引发异常:

'main' has not been registered. This can happen if: 
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running,stop it and restart it in the current project. 
* A module Failed to load due to an error and `AppRegistry.registerComponent` wasn't called.

我按照官方文档中的指南进行安装。

App.js:

import React from 'react';
import { View } from 'react-native';

const RNFS = require("react-native-fs");

export default function App() {
  return (

    <View>

    </View>

  );
}

package.json:

{
  "main": "index.js","scripts": {
    "android": "react-native run-android","ios": "react-native run-ios","web": "expo start --web","start": "react-native start","test": "jest"
  },"dependencies": {
    "expo": "~39.0.2","expo-splash-screen": "~0.6.0","expo-status-bar": "~1.0.2","expo-updates": "~0.3.2","react": "16.13.1","react-dom": "16.13.1","react-native": "~0.63.2","react-native-fs": "^2.16.6","react-native-gesture-handler": "~1.7.0","react-native-reanimated": "~1.13.0","react-native-screens": "~2.10.1","react-native-unimodules": "~0.11.0","react-native-web": "~0.13.12"
  },"devDependencies": {
    "@babel/core": "~7.9.0","babel-jest": "~25.2.6","jest": "~25.2.6","react-test-renderer": "~16.13.1"
  },"jest": {
    "preset": "react-native"
  },"private": true
}

很明显,如果我删除require行,则错误消失了。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。