tfjs: tfjs-react-native got error [TypeError: undefined is not an object (evaluating 'env().platform.fetch')] with Apple M1 Pro

I run my code on my Apple M1 Pro(yarn ios) , got error

[TypeError: undefined is not an object (evaluating ‘env().platform.fetch’)]

{
  "name": "rntf",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "expo": "expo",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.17.4",
    "@tensorflow-models/mobilenet": "^2.1.0",
    "@tensorflow/tfjs": "^3.17.0",
    "@tensorflow/tfjs-react-native": "^0.8.0",
    "expo": "^45.0.0",
    "expo-camera": "~12.2.0",
    "expo-gl": "~11.3.0",
    "expo-gl-cpp": "~11.3.0",
    "react": "17.0.2",
    "react-native": "0.68.2",
    "react-native-fs": "^2.20.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.67.0",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}

I had reade this https://github.com/tensorflow/tfjs/issues/3300 , could not fix

I try to run this https://github.com/tensorflow/tfjs-examples/tree/master/react-native/image-classification/react-native-cli but failed

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17

Most upvoted comments

@bergkamp How did you resolve this issue? Can you share the working package.json and App.js?

Does anyone have the answer on how to go past this?