error: bundling failed: Error: Unable to resolve module `react-native-get-real-path` from `App.js`: react-native-get-real-path could not be found within the project. #20
error: bundling failed: Error: Unable to resolve module `react-native-get-real-path` from `App.js`: react-native-get-real-path could not be found within the project.
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
at ModuleResolver.resolveDependency (/home/buddhi/react-tutorials/firstapp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15)
at ResolutionRequest.resolveDependency (/home/buddhi/react-tutorials/firstapp/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (/home/buddhi/react-tutorials/firstapp/node_modules/metro/src/node-haste/DependencyGraph.js:282:16)
at Object.resolve (/home/buddhi/react-tutorials/firstapp/node_modules/metro/src/lib/transformHelpers.js:267:42)
at dependencies.map.result (/home/buddhi/react-tutorials/firstapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:426:31)
at Array.map (<anonymous>)
at resolveDependencies (/home/buddhi/react-tutorials/firstapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:423:18)
at /home/buddhi/react-tutorials/firstapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (/home/buddhi/react-tutorials/firstapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
I'm using Ubuntu 19.10. Moreover, I have installed the package properly. here is the App.js code;
import RNGRP from 'react-native-get-real-path';
async MultipleFilePicker() {
try {
const res = await DocumentPicker.pickMultiple({
type: [DocumentPicker.types.allFiles],
});
for (const results of res) {
//Printing the log realted to the file
console.log('res : ' + JSON.stringify(results));
console.log('URI : ' + results.uri);
console.log('Type : ' + results.type);
console.log('File Name : ' + results.name);
console.log('File Size : ' + results.size);
//get the files URI
let url = results.uri;
const split = url.split('/');
const name = split.pop();
const inbox = split.pop();
// Create an accesible file path
const realPath = `${RNFS.TemporaryDirectoryPath}${inbox}/${name}`;
// Print the file path
console.log('real path' + realPath);
RNGRP.getRealPathFromURI(realPath).then(filePath =>
console.log("RNGRP : "+ filePath)
)
// Recheck if the selected file exists
RNFS.exists(realPath).then((success) => {
console.log('FILE exists!');
console.log('Success result' + success);
}).catch((err) => {
console.log('Returned an error!');
console.log(err.message);
})
}
this.setState({ multipleFile: res });
} catch (err) {
if (DocumentPicker.isCancel(err)) {
Alert.alert('Canceled');
} else {
Alert.alert('Unknown Error: ' + JSON.stringify(err));
throw err;
}
}
}
I'm using Ubuntu 19.10. Moreover, I have installed the package properly. here is the App.js code;