After initializing a fresh Next.js project using create-next-app
, I managed to successfully launch it with npm run dev
.
However, an issue arises every time Next.js boots up, displaying the following error:
FetchError: request to https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2 failed, reason:
at ClientRequest.<anonymous> (C:\Users\user\Desktop\documents\node_modules\next\dist\compiled\node-fetch\index.js:1:65756)
at ClientRequest.emit (node:events:511:28)
at TLSSocket.socketErrorListener (node:_http_client:495:9)
at TLSSocket.emit (node:events:511:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
type: 'system',
errno: 'ENETUNREACH',
code: 'ENETUNREACH'
}
- error Failed to download `Inter` from Google Fonts. Using fallback font instead.
My main objective is to have Next.js utilize the specified font instead of resorting to a fallback option.
Strangely, this issue occurs even though I haven't made any alterations to the Next.js setup yet. Furthermore, accessing the URL
https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2
in my web browser functions smoothly, indicating that it's likely not a network-related problem.
I conducted a search through the Next.js documentation but didn't encounter any similar instances.
Here's the content of layout.tsx
, located within src/app/
:
import './globals.css'
import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] })
export const metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
}
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
)
}
Additionally, I am currently utilizing Node version 20.3.0
, npm version 9.4.1
, and Next.js version 13.4
, all of which are the latest versions available at the time of composing this inquiry.