-
Notifications
You must be signed in to change notification settings - Fork 21
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
Error: Cannot find module 'fs' => Runtime.ImportModuleError #35
Comments
More information is needed for this issue. |
@BenMoreton do you happen to have a minimal repro project that shows this issue? |
I got the same error message. I'm using NextJS 14.1 and i use import { NextResponse } from "next/server";
import heicConvert from "heic-convert";
export async function POST(request : Request){
const reader = await request.arrayBuffer()
console.log(reader)
console.log(Buffer.from(reader))
const heic = await heicConvert({
buffer : Buffer.from(reader),
format : "PNG",
quality : 1
})
const response = new NextResponse(heic, {
headers : {
"Content-Type" : "image/png"
}
})
return response
} I want to build my projet for make a try in production, so i use info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
✓ Linting and checking validity of types
Collecting page data .Error: Cannot find module 'fs'
at I (/Users/wglint/Desktop/ServerAI/serverai/.next/server/app/api/check/route.js:1:77)
at /Users/wglint/Desktop/ServerAI/serverai/.next/server/app/api/check/route.js:1:24025
at c (/Users/wglint/Desktop/ServerAI/serverai/.next/server/app/api/check/route.js:24:1098358)
at 2388 (/Users/wglint/Desktop/ServerAI/serverai/.next/server/app/api/check/route.js:24:1098483)
at t (/Users/wglint/Desktop/ServerAI/serverai/.next/server/webpack-runtime.js:1:127)
at 9704 (/Users/wglint/Desktop/ServerAI/serverai/.next/server/app/api/check/route.js:1:2750)
at t (/Users/wglint/Desktop/ServerAI/serverai/.next/server/webpack-runtime.js:1:127)
at 8816 (/Users/wglint/Desktop/ServerAI/serverai/.next/server/app/api/check/route.js:1:2008)
at t (/Users/wglint/Desktop/ServerAI/serverai/.next/server/webpack-runtime.js:1:127)
at 4157 (/Users/wglint/Desktop/ServerAI/serverai/.next/server/app/api/check/route.js:1:858) {
code: 'MODULE_NOT_FOUND'
}
> Build error occurred
Error: Failed to collect page data for /api/check
at /Users/wglint/Desktop/ServerAI/serverai/node_modules/next/dist/build/utils.js:1258:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'Error'
}
Collecting page data .% I install the latest version of heic-convert ( EDIT : With the version 1.2.4, i don't have problem |
@WGlint In your case, this is definitely a NextJS (or build) issue. You can find plenty of information about that already. Even just adding an explicit While I suspect the serverless issue to be similar, I can't really tell without seeing the problem. Searching for "serverless" is much more annoying than searching for "nextjs", since serverless is both a module and a concept and you get a lot of results about the concept. In general, server-side modules should be able to access Anyway, recent versions of Best advice for now is:
|
I'm getting this error from version 2.
The text was updated successfully, but these errors were encountered: