H
Hono•4mo ago
cdegrel

Hono Scalar failed with Vercel serverless function

I use @scalar/hono-api-reference to show an Api documentation and my stack use vercel with api directory. When I use vercel dev or in production mode, I have this error
Error: No "exports" main defined in /Users/***/Workspace/***/apps/emails/node_modules/@scalar/hono-api-reference/package.json
at exportsNotFound (node:internal/modules/esm/resolve:303:10)
at packageExportsResolve (node:internal/modules/esm/resolve:593:13)
at resolveExports (node:internal/modules/cjs/loader:591:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:668:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
at Function.Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (/Users/***/Workspace/***/apps/emails/api/index.ts:2:1)
at Module._compile (node:internal/modules/cjs/loader:1376:14) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Error: Function `api/index.ts` failed with exit code 1
Error: No "exports" main defined in /Users/***/Workspace/***/apps/emails/node_modules/@scalar/hono-api-reference/package.json
at exportsNotFound (node:internal/modules/esm/resolve:303:10)
at packageExportsResolve (node:internal/modules/esm/resolve:593:13)
at resolveExports (node:internal/modules/cjs/loader:591:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:668:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
at Function.Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (/Users/***/Workspace/***/apps/emails/api/index.ts:2:1)
at Module._compile (node:internal/modules/cjs/loader:1376:14) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Error: Function `api/index.ts` failed with exit code 1
I search a solution about this, if someone can help me 🙂 .
1 Reply
6190
6190•4mo ago
i have same problem before but in nodejs i solved it by add "type": "module" in package.json
Want results from more Discord servers?
Add your server