How can I force eas build to use locally installed packages?

Hello,

I have upgraded recently to SDK 42 from 41. Some packages that I use are not supported in SDK 42. When running eas build for android, I get the following error message and the build fails:

Error loading assets JSON from Metro. Ensure you have followed all expo-updates installation steps correctly. Unable to resolve module unimodules-permissions-interface from /build/workingdir/build/node_modules/expo-image-picker-multiple/node_modules/expo-media-library/build/MediaLibrary.js: unimodules-permissions-interface 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 and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*
  1 | import { EventEmitter, UnavailabilityError } from '@unimodules/core';
  2 | import { Platform } from 'react-native';
  3 | import { PermissionStatus, } from 'unimodules-permissions-interface';
  4 | import MediaLibrary from './ExponentMediaLibrary';
  5 | const eventEmitter = new EventEmitter(MediaLibrary);
  6 | export { PermissionStatus };

The error is happing on line number 4.3 (it cannot find “unimodules-permissions-interface”).

However, I had the same error locally, but I was able to fix the issue by removing the dependencies from the package and change the package source code as well.

Locally everything works fine, but it seems that eas build is fetching the packages directly from github (in package-lock.json the url is resolving to github).

I tried to clear the cache during the build and it didn’t work. I can’t make the build locally because local builds are not supported in Windows.

The command that I am using for the build is:

eas build --clear-cache --platform android

Any idea how to force Metro server to take the package from my local machine?

Thanks in advance.

You could perhaps try patch-package. Then EAS Build should make the changes on the fly.

Good idea. However, I just tried it and it didn’t work.

it sounds like you are modifying the package in node_modules? patch-package will handle that.

but also, try running expo doctor to make sure packages are correct for sdk 42

1 Like

I ran expo doctor and there was nothing wrong.
Concerning the changes, I do make them in node_modules. Now that I ran npm install after the changes, it worked!
Thanks

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.