Next.js fonts are erroring out on pnpm build
?
#60094
-
SummaryI am getting a bunch of this:
If I visit one of those links, it downloads the fonts, so why is Next.js failing to The only thing that I think I may have changed is moved the font declarations to a separate standalone library which I then import into my Next.js app. Would that be causing this perhaps? In the library I have: 'use client'
import React, { useEffect, useState } from 'react'
import { GoogleAnalytics } from 'nextjs-google-analytics'
import Script from 'next/script'
import {
Noto_Sans_Mono,
Noto_Sans_SC,
Noto_Sans_TC,
} from 'next/font/google'
import cx from 'classnames'
const notoSansMono = Noto_Sans_Mono({
weight: ['400', '700'],
preload: true,
subsets: [],
variable: '--font-noto-sans-mono',
})
const notoSansSC = Noto_Sans_SC({
weight: ['400', '700'],
preload: true,
subsets: ['latin'],
variable: '--font-noto-sans-sc',
})
const notoSansTC = Noto_Sans_TC({
weight: ['400', '700'],
preload: true,
subsets: ['latin'],
variable: '--font-noto-sans-tc',
})
export default function Container({
children,
}: {
children: React.ReactNode
}) {
const [className, setClassName] = useState<string>('hidden')
useEffect(() => {
setClassName(
cx(
notoSansMono.variable,
notoSansSC.variable,
notoSansTC.variable,
notoSansMono.className,
),
)
}, [])
return (
<html lang="en">
<body
className={cx(
className,
`font-sans w-full h-full min-w-screen min-h-screen`,
)}
>
<GoogleAnalytics trackPageViews />
<Script id="disable-scroll-restoration">{`window.history.scrollRestoration = "manual"`}</Script>
{children}
<div id="overlay" />
</body>
</html>
)
} In the app I then do 'use client'
import { Container } from '@my/lib'
export default function AppLayout({
children,
}: {
children: React.ReactNode
}) {
return <Container>{children}</Container>
} It has been erroring out for over 5 hours today, so I doubt it's a Google font thing. Any hints or suggestions? I will also note that it seems to build successfully on Vercel deploy, but just not building locally. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
try edit your package.json script but its only work in dev i dont know about build |
Beta Was this translation helpful? Give feedback.
-
I facing the same in production |
Beta Was this translation helpful? Give feedback.
-
I have this exact problem, but only in production—during the GitHub Actions CI/CD pipeline build. I can't figure out what to do about it. Any ideas/solutions please? |
Beta Was this translation helpful? Give feedback.
try edit your package.json script
"dev": "next dev" to "next dev --turbo"
but its only work in dev i dont know about build