Reputation: 173
I'm learning react native and building and app that use the camera and it works fine. Now I'm trying to make image classification but I'm getting this error after installing:
@tensorflow/tfjs-react-native --legacy-peer-deps
I get this:
Unable to resolve module react-native-fs from /Users/myuser/ALPR/node_modules/@tensorflow/tfjs-react-native/dist/bundle_resource_io.js: react-native-fs could not be found within the project or in these directories: node_modules
I don't know what should I do, I tried installing react-native-fs but I got this:
npm install react-native-fs npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @tensorflow/[email protected] npm ERR! Found: @tensorflow/[email protected] npm ERR! node_modules/@tensorflow/tfjs-backend-cpu npm ERR!
@tensorflow/tfjs-backend-cpu@"3.19.0" from @tensorflow/[email protected] npm ERR! node_modules/@tensorflow/tfjs npm ERR!
@tensorflow/tfjs@"^3.19.0" from the root project npm ERR!
@tensorflow/tfjs-backend-cpu@"3.19.0" from @tensorflow/[email protected] npm ERR!
node_modules/@tensorflow/tfjs-backend-webgl npm ERR!
@tensorflow/tfjs-backend-webgl@"3.19.0" from @tensorflow/[email protected] npm ERR! node_modules/@tensorflow/tfjs npm ERR!
@tensorflow/tfjs@"^3.19.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @tensorflow/tfjs-backend-cpu@"~3.11.0" from @tensorflow/[email protected] npm ERR! node_modules/@tensorflow/tfjs-react-native npm ERR!
@tensorflow/tfjs-react-native@"^0.8.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: @tensorflow/[email protected] npm ERR! node_modules/@tensorflow/tfjs-backend-cpu npm ERR! peer @tensorflow/tfjs-backend-cpu@"~3.11.0" from @tensorflow/[email protected] npm ERR!
node_modules/@tensorflow/tfjs-react-native npm ERR!
@tensorflow/tfjs-react-native@"^0.8.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See /Users/macmac/.npm/eresolve-report.txt for a full report.npm ERR! A complete log of this run can be found in: npm ERR!
/Users/macmac/.npm/_logs/2022-08-22T12_14_25_319Z-debug-0.log
I'm using this tutorial: https://www.bam.tech/article/how-to-recognize-real-time-object-in-reactnative-for-dummies
Hopefully somebody can help me with this. Thanks
This is the package.json
{
"name": "alpr",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"@react-native-async-storage/async-storage": "~1.17.3",
"@tensorflow/tfjs": "^3.19.0",
"@tensorflow/tfjs-react-native": "^0.8.0",
"expo": "~46.0.8",
"expo-camera": "~12.3.0",
"expo-gl": "~11.4.0",
"expo-gl-cpp": "~11.4.0",
"expo-media-library": "~14.2.0",
"expo-sharing": "~10.3.0",
"expo-status-bar": "~1.4.0",
"react": "18.0.0",
"react-native": "0.69.4"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
Upvotes: 0
Views: 1228
Reputation: 173
Finally I solved this by deleting the folder node_modules and then I used yarn install instead of npm.
Upvotes: 0