Running expo build:android seems to break my code

  1. SDK Version: 40
  2. Platforms(Android/iOS/web/all): Android/all

Every time I run “expo build:android” everything works fine during the build process. However after the build when I run “expo start” my app seems to have issues, and I need to reinstall expo to correct them.

Case example:

  1. Everything is working fine and my app has no bugs, running “expo start” works as expected.
  2. I close the metro bundler and build the android standalone app using “expo build:android -t app-bundle” and everything works as expected.
  3. The build has finished successfully. Later I run “expo start” again, but the bundler fails with -

Error: ENOENT: no such file or directory, lstat ‘/Users/Desktop/project_name/project/node_modules/@jimp/plugin-print/node_modules/core-js/features/array/virtual/.filter.js.icloud’

  1. I reinstall the expo cli using “npm install -g expo-cli” and it stops the above issue. I don’t know why.

  2. I run “expo start” again and the devtools open, I scan the QR code, then the bundler fails with -

Failed building JavaScript bundle.
Unable to resolve “./plugins/immutable” from “node_modules/pretty-format/build/index.js”

  1. I try clearing the cache with “expo start -c” and it does not help.
  2. I reinstall expo sdk and node modules using “expo upgrade”.
  3. Everything works fine again, running “expo start” works as expected, there are no bugs and the above issues no longer arise.

This has happened twice. What am I doing wrong?

Thanks!

i think it may have been some coincidence that you ran that command and it caused this, i don’t think it is deterministic. i suspect the issue is related to some unexpected interaction between the metro cache or watchman cache and icloud storage. i’d recommend moving your project outside of a directory that is automatically backed up on icloud (based on the information provided, i believe this is where your project is stored). there are often problems with file watchers when storing projects in dropbox, google drive, or icloud directories because they create and remove files and, well, file watching is hard.

Thanks for the suggestion. You’re correct it automatically backs up to icloud. I’ve run “expo build:ios” a number of times in the past and everything has worked as expected. It’s only since running “expo build:android -t app-bundle” that I’ve started experiencing this issue. It’s happened twice and I’ve faced the same issue both times.

I’ve appended the project folder with “.nosync” to prevent uploads to icloud and keep it on my local machine. I guess that should be enough to test the theory… I’ll comment back next time I build android to let you know if that is the cause :+1:t2:

Thanks Brent / notbrent

2 Likes

You’re correct, stopping icloud backup and storing the project file locally fixed the issues I was experiencing above.
Now all expo commands work as expected after running “expo build:android -t app-bundle”

Thanks again!