Error: ENOENT: no such file or directory
Unanswered
⃤ posted this in #help-forum
⃤OP
Hey, i made a nextjs project with an api but i got this error:
Error: ENOENT: no such file or directory, open 'C:\Users\juzo\Documents\ide.next\server\vendor-chunks\bridge.js'
Error: ENOENT: no such file or directory, open 'C:\Users\juzo\Documents\ide.next\server\vendor-chunks\bridge.js'
import { NextResponse } from "next/server";
export async function POST(request) {
try {
const body = await request.json();
const { code } = body;
if (!code) {
return NextResponse.json(
{ error: "Code is required" },
{ status: 400 }
);
}
const { VM } = require("vm2");
const vm = new VM({
timeout: 1000,
sandbox: {},
});
const result = vm.run(code);
return NextResponse.json({ result });
} catch (err) {
return NextResponse.json(
{ error: err.message },
{ status: 400 }
);
}
}