我正在尝试在我的应用程序中使用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:我通过create-react-native-app创建了我的项目
有什么想法吗?
发布于 2018-01-26 06:34:29
你需要在你的项目中使用link react-native fs。在终端react-native link react-native-fs中运行此命令
https://stackoverflow.com/questions/47923076
复制相似问题