0

I am trying to use Tensorflow for one of my project, and i have two .bin files that i want to load locally. I added them in assets folder, and now using code like:

const modelWeights1 = await require('../../assets/group1-shard1of2.bin');

Getting this error:

Android Bundling failed 10951ms node_modules/expo-router/entry.js (1247 modules)
Unable to resolve "../..assets/group1-shard1of2.bin" from "app/(tabs)/poseview.tsx"

I have searched alot, most of the solutions were to add metro.config.js

metro.config.js:

const { getDefaultConfig } = require('metro-config');
module.exports = (async () => {
  const defaultConfig = await getDefaultConfig();
  const { assetExts } = defaultConfig.resolver;
  return {
    resolver: {
      // Add bin to assetExts
      assetExts: [...assetExts, 'bin'],
    }
  };
})();

still its not working, I am getting the same issue. I am using Expo 52

1 Answer 1

0

After trying to fix it for two days, i found out, I created metro.config.js manually, so I deleted it again and put below code in terminal

npx expo customize metro.config.js

this generates metro.config.js file for you in the root folder.

then pasted below code in the file

const { getDefaultConfig } = require("expo/metro-config");
const config = getDefaultConfig(__dirname);

// Added this line:
config.resolver.assetExts.push("bin");

module.exports = config;

and it started working

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.