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

[router] Cannot find module '../../_ctx-shared' when compiling typed routes in canary #27740

Closed
chriszs opened this issue Mar 19, 2024 · 3 comments
Labels

Comments

@chriszs
Copy link

chriszs commented Mar 19, 2024

Minimal reproducible example

chriszs/test-expo-app#3

Which package manager are you using? (Yarn is recommended)

npm

If the issue is web-related, please select the bundler (web.bundler in the app.json)

metro

Summary

I get the following error after upgrading Expo and Expo Router to canary and running npm start with experimental typed route support turned on:

Error: Cannot find module '../../_ctx-shared'
Require stack:
- /Users/admin/Desktop/work/statnews/mobile/node_modules/expo-router/build/typed-routes/index.js
- /Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/start/server/type-generation/routes.js
- /Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/start/server/type-generation/startTypescriptTypeGeneration.js
- /Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js
- /Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/start/server/DevServerManager.js
- /Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/run/startBundler.js
- /Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/run/ios/runIosAsync.js
- /Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/run/ios/index.js
- /Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/bin/cli
- /Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/expo/bin/cli
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/admin/Desktop/work/statnews/mobile/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/Users/admin/Desktop/work/statnews/mobile/node_modules/expo-router/src/typed-routes/index.ts:5:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.require.extensions.<computed> [as .js] (/Users/admin/Desktop/work/statnews/mobile/node_modules/ts-node/src/index.ts:1608:43)
    at Module.load (node:internal/modules/cjs/loader:1119:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/admin/Desktop/work/statnews/mobile/node_modules/expo-router/build/typed-routes/index.js',
    '/Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/start/server/type-generation/routes.js',
    '/Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/start/server/type-generation/startTypescriptTypeGeneration.js',
    '/Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js',
    '/Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/start/server/DevServerManager.js',
    '/Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/run/startBundler.js',
    '/Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/run/ios/runIosAsync.js',
    '/Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/src/run/ios/index.js',
    '/Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/@expo/cli/build/bin/cli',
    '/Users/admin/Desktop/work/statnews/mobile/apps/mobile/node_modules/expo/bin/cli'
  ]
}

The issue occurs on line 10 of expo-router/build/typed-routes/index.js:

const _ctx_shared_1 = require("../../_ctx-shared");

Looking at the relevant directory in node-modules, I don't see _ctx-shared, but I do see it in GitHub, which leads me to believe it's being excluded by the explicit list of included files in Expo Router's package.json. If so, this should be an easy fix: just add that file to the package.json files list.

Environment

  expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.3.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.17.1 - ~/.asdf/installs/nodejs/18.17.1/bin/node
      Yarn: 1.22.21 - ~/.asdf/installs/nodejs/18.17.1/bin/yarn
      npm: 9.6.7 - ~/.asdf/plugins/nodejs/shims/npm
      Watchman: 2023.12.04.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.14.3 - /Users/admin/.asdf/shims/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, watchOS 10.2
    IDEs:
      Android Studio: 2023.1 AI-231.9392.1.2311.11330709
      Xcode: 15.1/15C65 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^50.0.6 => 50.0.13 
    Expo Workflow: managed
@chriszs chriszs added needs validation Issue needs to be validated Router expo-router labels Mar 19, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Mar 19, 2024
@chriszs chriszs changed the title [expo-router] [SDK51] Cannot find module '../../_ctx-shared' when compiling typed routes in canary [router] Cannot find module '../../_ctx-shared' when compiling typed routes in canary Mar 19, 2024
@expo-bot
Copy link
Collaborator

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@github-actions github-actions bot removed the needs review Issue is ready to be reviewed by a maintainer label Mar 20, 2024
@marklawlor
Copy link
Contributor

Will be addressed in #27690

@chriszs
Copy link
Author

chriszs commented Mar 26, 2024

With #27690 now merged, I think safe to assume this is fixed.

@chriszs chriszs closed this as completed Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants