Javascript 尝试在创建react native应用程序项目(expo)中使用react native fs

Javascript 尝试在创建react native应用程序项目(expo)中使用react native fs,javascript,android,ios,react-native,react-native-fs,Javascript,Android,Ios,React Native,React Native Fs,我正在尝试在我的应用程序中使用react native fs上载文件等。 我按照文档一样进行了安装,进行了导入,并将以下代码用于测试: componentDidMount(){ const path = RNFS.DocumentDirectoryPath + '/test.txt'; console.log(path); // write the file RNFS.writeFile(path, 'Lorem ipsum dolor sit amet', 'u

我正在尝试在我的应用程序中使用react native fs上载文件等。 我按照文档一样进行了安装,进行了导入,并将以下代码用于测试:

componentDidMount(){
    const path = RNFS.DocumentDirectoryPath + '/test.txt';
    console.log(path);
    // write the file
    RNFS.writeFile(path, 'Lorem ipsum dolor sit amet', 'utf8')
        .then((success) => {
            console.log('FILE WRITTEN!');
        })
        .catch((err) => {
            console.log(err.message);
    });
}
它直接给我带来了这个错误:

ps:我通过CreateReact原生应用程序创建了我的项目


有什么想法吗?

您需要在项目中添加链接。 在终端反应本机链接反应本机fs中运行此操作