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

next build ERR_MODULE_NOT_FOUND .../@farcaster/frame-sdk/dist/frameHost #31

Open
zacharytyhacz opened this issue Dec 12, 2024 · 1 comment

Comments

@zacharytyhacz
Copy link

  • "next": "^14.2.2"
  • "@farcaster/frame-sdk": "^0.0.16",
  • Node version: 'v23.1.0' and tried v20.8.0

On the "Collecting page data" step in npm run build

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/zact/Projects/test/app.test.co/node_modules/@farcaster/frame-sdk/dist/frameHost' imported from /Users/zact/Projects/test/app.test.co/node_modules/@farcaster/frame-sdk/dist/sdk.js
    at finalizeResolution (node:internal/modules/esm/resolve:275:11)
    at moduleResolve (node:internal/modules/esm/resolve:932:10)
    at defaultResolve (node:internal/modules/esm/resolve:1056:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:650:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:599:25)
    at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:349:53)
    at new ModuleJobSync (node:internal/modules/esm/module_job:338:34)
    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:322:11)
    at loadESMFromCJS (node:internal/modules/cjs/loader:1396:24)
    at Module._compile (node:internal/modules/cjs/loader:1529:5) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///Users/zact/Projects/test/app.test.co/node_modules/@farcaster/frame-sdk/dist/frameHost'
}
(node:65780) ExperimentalWarning: CommonJS module /Users/zact/Projects/test/app.test.co/.next/server/pages/fc-app/[...view].js is loading ES Module /Users/zact/Projects/test/app.test.co/node_modules/@farcaster/frame-sdk/dist/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
  • I have tried reinstall the package
  • I have tried removing .next folder, still same error

Different error with node v20.8.0

   Collecting page data  .../Users/zact/Projects/test/app.test.co/node_modules/@farcaster/frame-sdk/dist/index.js:1
import { sdk } from "./sdk";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1153:20)
    at Module._compile (node:internal/modules/cjs/loader:1205:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (/Users/zact/Projects/test/app.test.co/node_modules/next/dist/server/require-hook.js:65:28)
    at require (node:internal/modules/helpers:130:18)
    at 6536 (/Users/zact/Projects/test/app.test.co/.next/server/pages/fc-app/[...view].js:1:7568)

> Build error occurred
Error: Failed to collect page data for /fc-app/[...view]
    at /Users/zact/Projects/test/app.test.co/node_modules/next/dist/build/utils.js:1268:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}

Any ideas?

@zacharytyhacz
Copy link
Author

Ok, somehow this fixes it:

const { sdk } = await import('@farcaster/frame-sdk');

sdk.actions...
sdk.context...

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

No branches or pull requests

1 participant