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

10.0.0 Running in RN + Expo CRASH BUNDLE #667

Open
4 tasks done
giovanijfc opened this issue Jun 14, 2024 · 3 comments
Open
4 tasks done

10.0.0 Running in RN + Expo CRASH BUNDLE #667

giovanijfc opened this issue Jun 14, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@giovanijfc
Copy link

Steps to reproduce

Hi, I installed the lib in version 10.0.0 and in my app made in react-native 0.72.6 + expo 49.0.15 and the bundle is breaking.

Failure Logs

Android Bundling failed 333ms
error: Error: The package `/node_modules/youtubei.js/package.json` is invalid because it specifies a `main` module field that could not be resolved (`/node_modules/youtubei.js/index`. None of these files exist:

  * /node_modules/youtubei.js/index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)
  * /node_modules/youtubei.js/index/index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)
    at resolvePackageEntryPoint (/node_modules/metro-resolver/src/resolve.js:339:11)
    at resolveModulePath (/node_modules/metro-resolver/src/resolve.js:172:21)
    at resolvePackage (/node_modules/metro-resolver/src/resolve.js:299:10)
    at resolve (/node_modules/metro-resolver/src/resolve.js:138:20)
    at doResolve (/node_modules/@expo/cli/build/src/start/server/metro/withMetroMultiPlatform.js:181:24)
    at /node_modules/@expo/cli/build/src/start/server/metro/withMetroMultiPlatform.js:217:48
    at resolveRequest (/node_modules/@expo/cli/build/src/start/server/metro/withMetroResolvers.js:30:44)
    at Object.resolve (/node_modules/metro/node_modules/metro-resolver/src/resolve.js:47:12)
    at ModuleResolver.resolveDependency (/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:86:31)
    at DependencyGraph.resolveDependency (/node_modules/metro/src/node-haste/DependencyGraph.js:282:43)

Expected behavior

The app loaded the bundle without a problem

Current behavior

The bundle crashes while I keep importing the module

Version

Default

Anything else?

No response

Checklist

  • I am running the latest version.
  • I checked the documentation and found no answer.
  • I have searched the existing issues and made sure this is not a duplicate.
  • I have provided sufficient information.
@giovanijfc giovanijfc added the bug Something isn't working label Jun 14, 2024
@nohwolde
Copy link

nohwolde commented Jun 16, 2024

facing the same issue as above, metro requires a main file to be specified or an index.js to be present in any node module packages. adding "main": "./bundle/react-native.js", to the package.json allows for successful import and usage of the library, however I'm not sure if this is too hacky or will leave things out that are necessary for other functionality that I haven't tested yet

@absidue
Copy link
Collaborator

absidue commented Jun 16, 2024

Please make sure you both fully follow the react-native instructions: https://github.com/LuanRT/YouTube.js/blob/main/src/platform/react-native.md

@nohwolde
Copy link

Please make sure you both fully follow the react-native instructions: https://github.com/LuanRT/YouTube.js/blob/main/src/platform/react-native.md

yes I made sure to follow that but even with adding those configs it didn't change anything metro still isn't able to find the main file without adding that line to the package.json. The error might have something to do with myself and the original poster using expo since I know you can also use React native cli as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants