Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The resource main.tsx was not found. #2553

Open
mgphall opened this issue Nov 11, 2024 · 4 comments
Open

The resource main.tsx was not found. #2553

mgphall opened this issue Nov 11, 2024 · 4 comments
Labels
question Further information is requested

Comments

@mgphall
Copy link

mgphall commented Nov 11, 2024

Ask your Question

I hope this is the right place to ask?

We are in the process of upgrading our application/monorepo , which started at version 0.68 and is currently moving from RN 0.70.15 to 0.71.19. We are completing one upgrade per sprint and have been using the upgrade helper successfully for this process.

During this upgrade, we encountered the error mentioned above.

./gradlew build
The error:
error The resource C:\projects\core-platform-frontend\src\main.tsx was not found.
Error: The resource C:\projects\core-platform-frontend\src\main.tsx was not found.
at C:\projects\core-platform-frontend\node_modules@react-native-community\cli-plugin-metro\node_modules\metro\src\IncrementalBundler.js:275:24
at gotStat (node:fs:2806:21)
at FSReqCallback.oncomplete (node:fs:202:21)

./gradlew assembleRelease --info

Task :app:createBundleDevReleaseJsAndAssets FAILED
Caching disabled for task ':app:createBundleDevReleaseJsAndAssets' because:
Build cache is disabled
Task ':app:createBundleDevReleaseJsAndAssets' is not up-to-date because:
No history is available.
Starting process 'command 'cmd''. Working directory: C:\projects\core-platform-frontend\apps\colleague-portal-native Command: cmd /c node node_modules\react-native\cli.js bundle --platform android --dev false --reset-cache --entry-file src\main.tsx --bundle-output android\app\build\ASSETS\createBundleDevReleaseJsAndAssets\index.android.bundle --assets-dest android\app\build\generated\res\react\devRelease --sourcemap-output android\app\build\intermediates\sourcemaps\react\devRelease\index.android.bundle.packager.map --minify false --verbose
Successfully started process 'command 'cmd''

The only change i can see it with regards to entry file is in the build gradle file

project.ext.react = [
    entryFile: "apps/colleague-portal-native/src/main.tsx",
    enableHermes: true,  // clean and rebuild if changing
    hermesCommand: "../../../../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
]

to ->

 react {
    entryFile = file("/../../src/main.tsx")
    println("entryFile: ${entryFile.get().asFile.absolutePath}") , <-  the correct file path
    hermesCommand = "../../../../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
}

info Fetching system and libraries information...
System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i9-12900HK
    Memory: 5.32 GB / 31.68 GB
  Binaries:
    Node: 18.20.3 - ~\AppData\Local\nvs\default\node.EXE
    Yarn: Not Found
    npm: 10.8.3 - ~\AppData\Roaming\npm\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.17763.0, 10.0.19041.0
  IDEs:
    Android Studio: AI-232.10300.40.2321.11567975
    Visual Studio: 15.9.35324.217 (Visual Studio Enterprise 2017), 17.11.34929.205 (Visual Studio Enterprise 2022), 17.11.35327.3 (Visual Studio Enterprise 2022)
  Languages:
    Java: 17.0.2
  npmPackages:
    @react-native-community/cli: ^10.2.7 => 10.2.7
    react: 18.2.0 => 18.2.0
    react-native: 0.71.19 => 0.71.19
@mgphall mgphall added the question Further information is requested label Nov 11, 2024
@mgphall mgphall changed the title The resource C:\projects\core-platform-frontend\src\main.tsx was not found. The resource main.tsx was not found. Nov 11, 2024
@mgphall
Copy link
Author

mgphall commented Nov 15, 2024

am i missing anything here ?

@Gvan-dev
Copy link

Ask your Question

I hope this is the right place to ask?

We are in the process of upgrading our application/monorepo , which started at version 0.68 and is currently moving from RN 0.70.15 to 0.71.19. We are completing one upgrade per sprint and have been using the upgrade helper successfully for this process.

During this upgrade, we encountered the error mentioned above.

./gradlew build The error: error The resource C:\projects\core-platform-frontend\src\main.tsx was not found. Error: The resource C:\projects\core-platform-frontend\src\main.tsx was not found. at C:\projects\core-platform-frontend\node_modules@react-native-community\cli-plugin-metro\node_modules\metro\src\IncrementalBundler.js:275:24 at gotStat (node:fs:2806:21) at FSReqCallback.oncomplete (node:fs:202:21)

./gradlew assembleRelease --info

Task :app:createBundleDevReleaseJsAndAssets FAILED
Caching disabled for task ':app:createBundleDevReleaseJsAndAssets' because:
Build cache is disabled
Task ':app:createBundleDevReleaseJsAndAssets' is not up-to-date because:
No history is available.
Starting process 'command 'cmd''. Working directory: C:\projects\core-platform-frontend\apps\colleague-portal-native Command: cmd /c node node_modules\react-native\cli.js bundle --platform android --dev false --reset-cache --entry-file src\main.tsx --bundle-output android\app\build\ASSETS\createBundleDevReleaseJsAndAssets\index.android.bundle --assets-dest android\app\build\generated\res\react\devRelease --sourcemap-output android\app\build\intermediates\sourcemaps\react\devRelease\index.android.bundle.packager.map --minify false --verbose
Successfully started process 'command 'cmd''

The only change i can see it with regards to entry file is in the build gradle file

project.ext.react = [
    entryFile: "apps/colleague-portal-native/src/main.tsx",
    enableHermes: true,  // clean and rebuild if changing
    hermesCommand: "../../../../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
]

to ->

 react {
    entryFile = file("/../../src/main.tsx")
    println("entryFile: ${entryFile.get().asFile.absolutePath}") , <-  the correct file path
    hermesCommand = "../../../../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
}
info Fetching system and libraries information...
System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i9-12900HK
    Memory: 5.32 GB / 31.68 GB
  Binaries:
    Node: 18.20.3 - ~\AppData\Local\nvs\default\node.EXE
    Yarn: Not Found
    npm: 10.8.3 - ~\AppData\Roaming\npm\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.17763.0, 10.0.19041.0
  IDEs:
    Android Studio: AI-232.10300.40.2321.11567975
    Visual Studio: 15.9.35324.217 (Visual Studio Enterprise 2017), 17.11.34929.205 (Visual Studio Enterprise 2022), 17.11.35327.3 (Visual Studio Enterprise 2022)
  Languages:
    Java: 17.0.2
  npmPackages:
    @react-native-community/cli: ^10.2.7 => 10.2.7
    react: 18.2.0 => 18.2.0
    react-native: 0.71.19 => 0.71.19

@rohan-roadflex
Copy link

Did you find any solutions? I am facing the same issue, trying to upgrade from 0.70.0 to 0.72.0

@airowe
Copy link

airowe commented Nov 21, 2024

@mgphall Your error message is indicating the file wasn't found at C:\projects\core-platform-frontend\src\main.tsx but your entry file (according to build.gradle prior to your changes) is at apps/colleague-portal-native/src/main.tsx.

Is it possible you went up to high in your directory structure when you changed to entryFile = file("/../../src/main.tsx")?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants