Next.js Discord

Discord Forum

TypeError: e is not a function, but there is no e

Answered
Standard Chinchilla posted this in #help-forum
Open in Discord
Standard ChinchillaOP
I have made a npm run build but i get this error:
{TypeError: e is not a function
    at a (C:\projekter\hammervig.dk\Christian\.next\server\app\loves_rosie_and_bella\page.js:1:2620)
  ...
    at nh (C:\projekter\hammervig.dk\Christian\node_modules\next\dist\compiled\next-server\app-page.runtime.prod.js:45:53366)
    at np (C:\projekter\hammervig.dk\Christian\node_modules\next\dist\compiled\next-server\app-page.runtime.prod.js:45:51306)}


the code in the page
'use client'
import React, { useEffect, useState } from 'react';
import { Box } from '@/lib/mui'
import { useAppContext } from '$/AppContext';
import { Title, Countdown } from '$/Components';

export default function MyQueens({ sprog }) {
    const knapper = [
        { navn: sprog('profil', 'profile'), link: '/profil' },
        { navn: sprog('Gæstebog', 'Guestbook'), link: '/gaestebog' },
        //{ navn: 'Ønskelister', link: '/onsker' },
        //{ navn: 'Mine ønsker', link: '/mine_onsker' },
    ];
    const [vis, setVis] = useState(false)
    /*const { isLoggedIn, ikkeOnline, user, language } = useAppContext();
    useEffect(() => {
        if (user.role === "FISSE" && isLoggedIn) {
            setVis(true)
        }
    }, [isLoggedIn, user])*/

    return (
        <Box>
            {/*vis ?
                (<Box>
   T
                   </Box>)
                : <Title>{ikkeOnline(language)}</Title>
            }
            <Box sx={{ sx }}>
                {
                    knapper.map((k, i) => {
                        return (
                            <Link href={k.link} key={i}>
                                    {k.navn}
                                </Link>
                        )
                    })
            </Box>
                */}
        </Box>
    )
}

I have tried to comment out everything so it doesn't do anything but i still get the error
Answered by Standard Chinchilla
I found the error
this
import { Title, Countdown } from '$/Components';

export default function MyQueens({ sprog }) {  //
    const knapper = [
        { navn: sprog('profil', 'profile'), link: '/profil' },
        { navn: sprog('Gæstebog', 'Guestbook'), link: '/gaestebog' },

should be replaced by this
import { Title, Countdown } from '$/Components';

export default function MyQueens() {
    const knapper = [
        { navn: 'profile', link: '/profil' },
        { navn: 'Guestbook', link: '/gaestebog' },

and then it worked fine
View full answer

1 Reply

Standard ChinchillaOP
I found the error
this
import { Title, Countdown } from '$/Components';

export default function MyQueens({ sprog }) {  //
    const knapper = [
        { navn: sprog('profil', 'profile'), link: '/profil' },
        { navn: sprog('Gæstebog', 'Guestbook'), link: '/gaestebog' },

should be replaced by this
import { Title, Countdown } from '$/Components';

export default function MyQueens() {
    const knapper = [
        { navn: 'profile', link: '/profil' },
        { navn: 'Guestbook', link: '/gaestebog' },

and then it worked fine
Answer