Skip to content

WTF Issues

seanim0920 edited this page Sep 21, 2024 · 33 revisions

In an ideal world, development tooling should aid in the development of applications, not hinder it. Unfortunately, npm and the JS ecosystem are notorious for not exactly following this tenet. Whether it’s improper usage of these tools (eg. We’re holding it wrong), or due to a bug in these tools, this document serves as an archive of the past "what the fuck" issues that we have ran into. Issues in this document should not represent app bugs, but rather issues related to the tooling and configuration we use to develop the app. As of writing, we have begun tracking issues from 6/11/24 onwards.

Each issue is to be placed in any of the below categories. If warranted, you may create a new category for a specific issue if needed. Ensure that the new category title is using a header 2 in markdown, and include a brief description of the issues that the category tracks.

Each issue should have the following format:

### Title (Platforms) [discovery date]
Now you put a description of the issue here. Make sure to update this with new information as you debug the issue, but ensure to keep past information such as what it looked like when it first appeared.

#### Attempted Fixes
1. Each attempt should be put in a
2. Numerical list. Feel free to add
  - sublists if necessary.

#### Fix
This section should detail what you did to fix the issue. If this is an ongoing issue, put "???" here.

If you happen to (by a miracle) to resolve an issue on the first resolution attempt, then the attempted fixes section can be omitted.

NPM Issues

The following issues relate to any problems with node package conflicts, or any other reasons for why an npm install may fail.

GitHub CI not recognizing package.json changes [8/28/24]

When updating package.jsons, changes may not propagate immediately in CI.

Fix

Uninstall packages from the repo and remove package-lock.json, then push to CI, and then reinstall packages, regenerate package-lock.json and push again to CI to force it to update.

GitHub CI installing outdated version of TiFShared [8/10/24]

When working on the backend repo which depends on a specific version of TiFShared, updating that version of TiFShared directly may not propagate changes to the repo immediately in CI. ex. I work on repo A which depends on TiFShared version X If I update TiFShared version X, the github CI for repo A will still run CI jobs as if version X was not updated.

Fix

I uninstalled TiFShared from the repo, pushed to CI, and then reinstalled and pushed again to CI to force it to get the newer version.

Node Module Resolution Issues

The following issues relate to any node module resolution errors that happen at runtime. This can be part of either running unit tests, or running the app.

Cannot resolve any 3rd party module (Android, iOS) [6/26/24]

After opening the app from running npm run sb_start the following error is logged.

Android Bundling failed 842ms (AppEntry.js)
Unable to resolve "expo" from "AppEntry.js"
iOS Bundling failed 39ms (AppEntry.js)
Unable to resolve "expo" from "AppEntry.js"

Originally, we thought that only “expo” had this issue. Upon further investigation, we realized that it applied to any node module, including pure JS modules like zod. Later on, after messing around with import paths, this error started to show.

iOS Bundling failed 660ms (AppEntry.js)
Unable to resolve "@babel/runtime/helpers/interopRequireDefault" from "AppEntry.js"

Attempted Fixes

  1. Reclone repo.
  2. Reinstall all node modules.
  3. Remove .watchmanconfig.
  4. Checking out previous commits where we have verified that this error doesn’t occur (for some reason, those commits were now failing too…).
  5. Running npx jest --clear-cache.

Fix

The general fix seems to involve uninstalling watchman (right after installing it for fixing the EMFILE issue???). choco uninstall watchman (Windows) brew uninstall watchman (macOS)

Android Studio Build Issues

The following issues relate to compiling, building, and running the android project using Android Studio.

A problem occurred evaluating root project 'android'. [9/17/24] (Windows 10, Android Studio 2024.1.2)

Error message when attempting to build android project:

  • Build file 'C:\Users\seani\FitnessProject\modules\event-settings-wheel-duration-picker\android\build.gradle' line: 1

A problem occurred evaluating root project 'android'.

Plugin with id 'com.android.library' not found.

  • Occurs on event-settings-wheel-duration-picker, not the main android/ project

Attempted Fixes

  1. Upgrade gradle to 8.5 and then try re-syncing
  2. Remove outdated Android Studio version
  3. Install Android API, SDK Platform Tools and SDK Build Tools
  4. Invalidate Caches and restart Android Studio
  5. Insert the proper gradle files into gradle/wrapper
  6. Delete old versions of gradle from the gradle/ folder
  7. Invalidate caches again
  8. Copy contents from main android/gradle in root folder to the module
  9. https://stackoverflow.com/questions/18153739/android-studio-plugin-with-id-android-library-not-found
  10. Try gradle version 8.6.0
  11. Use this at the top of the build.gradle for the module
buildscript {
  repositories {
    google()
    mavenCentral()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:8.0.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10"
  }
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
...
  1. See solution below

Could not find :expo-core-modules. [9/17/24] (Windows 10, Android Studio 2024.1.2)

A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
   > Could not find expo.modules:expo-modules-gradle-plugin:1.0.4.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/expo/modules/expo-modules-gradle-plugin/1.0.4/expo-modules-gradle-plugin-1.0.4.pom
       - https://repo.maven.apache.org/maven2/expo/modules/expo-modules-gradle-plugin/1.0.4/expo-modules-gradle-plugin-1.0.4.pom
     Required by:
         project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Attempted Fixes

  1. Build main android project
  2. Open module folders from the android project folder 3. Open the root android project in android studio and modify the other android modules through that. Do not try editing the individual android modules in isolation.

Xcode Build Issues

All issues here only relate to macOS The following issues relate to compiling, building, and running the ios project using Xcode.

Sentry does not compile (Xcode 16 Beta 2) [6/26/24]

Compiler Errors

SentryCrashMonitor_CPPException:60 No type named 'terminate_handler' in namespace 'std'

Attempted Fixes

  1. Upgrade @sentry/react-native to version 5.24.1

Fix

Upgrade @sentry/react-native to version 5.32.0, ad upgrade react-native to version 0.51. Note that this fix came after the final release of Xcode 16 on 9/17/2024.

Expo Dev Server Issues

The following issues are related to running and debugging the app with expo’s dev server. All issues are in the context of the expo bare workflow (ie. We control the native Xcode and Android Studio projects, not expo). The dev server is ran with the --dev-client flag.

Metro Dev Server Timeout (Windows 10) [6/11/24]

You must wait ~5 minutes before launching the dev server app after running npm run sb_start or else a timeout error will occur..

Fix

Added this to the .watchmanconfig in the root of the repo:

{
  "ignore_dirs": ["node_modules"]
}

EMFILE errno when running dev server (macOS Sequoia Beta 2) [6/26/24]

A few seconds after running npm run sb_start the dev server crashes with an EMFILE (too many open files) errno. Logs:

node:events:495
      throw er; // Unhandled 'error' event
      ^

Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)
Emitted 'error' event on NodeWatcher instance at:
    at FSWatcher._checkedEmitError (/Users/matthewhayes/Developer/side_projects/Fit2/node_modules/metro-file-map/src/watchers/NodeWatcher.js:82:12)
    at FSWatcher.emit (node:events:517:28)
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:213:12) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null
}

Node.js v18.19.0

Attempted Fixes

  1. Ran cd android followed by a ./gradlew clean.
  2. Restarted computer.

Fix

Ran brew update followed by brew install watchman.

EMFILE errno when running dev server (macOS Sequoia Beta 2) [Resurged on 7/5/24]

A few seconds after running npm run sb_start the dev server crashes with an EMFILE (too many open files) errno. Logs:

node:events:495
      throw er; // Unhandled 'error' event
      ^

Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)
Emitted 'error' event on NodeWatcher instance at:
    at FSWatcher._checkedEmitError (/Users/matthewhayes/Developer/side_projects/Fit2/node_modules/metro-file-map/src/watchers/NodeWatcher.js:82:12)
    at FSWatcher.emit (node:events:517:28)
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:213:12) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null
}

Node.js v18.19.0

Attempted Fixes

  1. Restarted Computer.
  2. Installed watchman (this causes the error where no node modules can be resolved).
  3. Deleted the whole codebase (it still had "too many files" open).

Fix

Upgrade Expo to v51!

EAS Build Issues

The following issues relate to attempting to build the app using expo’s EAS build service. The issues here should specify whether they refer to local or remote EAS builds.

CI/Github Actions Issues

The following issues relate to CI problems and general GitHub actions issues.

Clone this wiki locally