Next.js Discord

Discord Forum

Prerender error:

Unanswered
Bigeye tuna posted this in #help-forum
Open in Discord
Original message was deleted.

24 Replies

Bigeye tuna
Anyone
@Bigeye tuna Anyone
Dutch
run npm run dev and tell me what happens
@Dutch run `npm run dev` and tell me what happens
Bigeye tuna
@Bigeye tuna Click to see attachment
Dutch
Okay now try to find packageName word in your app directory cuz its coming from there
Bigeye tuna
there is no packageName anywhere but in .next
Dutch
Hmm, is local npm run build giving same error
Bigeye tuna
yes except it keeps alternating between the file with the error
like sometimes it says prerendering page "/marketing"
@Bigeye tuna yes except it keeps alternating between the file with the error
Dutch
Open that file and show me
Bigeye tuna
"use client";

import Image from "next/image";
import { useUser } from "@clerk/clerk-react";
import { Button } from "@/components/ui/button";
import { PlusCircle } from "lucide-react";
import { useMutation } from "convex/react";
import { api } from "@/convex/_generated/api"; 
import { toast } from "sonner";
import { useRouter } from "next/navigation";


export default function DocumentsPage () {
    const router = useRouter();
    const { user } = useUser();
    const create = useMutation(api.documents.create);

    const onCreate = () => {
        const promise = create({ title: "Untitled"})
        .then((documentId) => router.push(`/documents/${documentId}`));
        toast.promise(promise, {
            loading: "Creating a new Note",
            success: "New note created",
            error: "Failed to create new note"
        })
    }

    return ( 
        <div className="h-full flex flex-col items-center justify-center space-y-4">
            <Image 
                src="/empty.png"
                height="300"
                width="300"
                alt="empty"
                className="dark:hidden"
            />
            <Image 
                src="/empty-dark.png"
                height="300"
                width="300"
                alt="empty"
                className="hidden dark:block"
            />
            <h2 className="text-lg font-medium">
                Welcome to {user?.firstName}&apos;s Motion
            </h2>
            <Button onClick={onCreate}>
                <PlusCircle className="h-4 w-4 mr-2"/>
                Create a Note
            </Button>
        </div>
     );
}
this is the app/(main)/(routes)/documents/page.tsx
Bigeye tuna
sure one sec
Bigeye tuna
how can I do that
@Bigeye tuna how can I do that
Dutch
open it in read/write mode, not readonly
Bigeye tuna
k one sec
Bigeye tuna
Dutch
Bigeye tuna
thank you very much