next.js: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME] on Windows Using [npm run dev]

Link to the code that reproduces this issue

https://github.com/Ahmed-Elgendy25/Next.js

To Reproduce

1- Clone the project: https://github.com/Ahmed-Elgendy25/Next.js “v14.2.0” 2- npm run dev

Current vs. Expected behavior

After I did (npx create-next-app@latest) and tried to run the project with (npm run dev)… I expected to see the default homepage of next.js, But It tells me:

An error occurred in next/font.

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol ‘d:’

at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:239:11)

at defaultLoad (node:internal/modules/esm/load:130:3)

at ModuleLoader.load (node:internal/modules/esm/loader:403:13)

at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:56)

at new ModuleJob (node:internal/modules/esm/module_job:67:26)

at #createModuleJob (node:internal/modules/esm/loader:297:17)

at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:254:34)

at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:235:17)

at async ModuleLoader.import (node:internal/modules/esm/loader:322:23)

⨯ app\layout.tsx

An error occurred in next/font.

next-bug next-bug2

Provide environment information

Operating System:
 Platform: win32
 Arch: x64
 Version: Windows 10 Pro (22H2)

Binaries:
 Node:v20.12.2
 npm:10.5.2
 Yarn: N/A
 pnpm: N/A

Relevant Packages:
 "react": "^18"
 "react-dom": "^18"
 "next": "14.2.0"
 "eslint-config-next": "14.2.0"
 "typescript": "^5",

Which area(s) are affected? (Select all that apply)

CLI (create-next-app)

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local)

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 months ago
  • Reactions: 23
  • Comments: 25 (1 by maintainers)

Most upvoted comments

I renamed my postcss.config.js file to postcss.config.cjs. This resolved the issue for me in Next.js v14.2.1.

I installed the latest version, but it wasn’t working as expected. Instead, I used npx create-next-app@14.1.0 and that worked successfully.

Yes we also had to create our projects using version 14.1.0 npx create-next-app@14.1.0 instead of the latest version as a temporary fix

14.2.0 version still has this error

npx create-next-app@14.1.0 works. The above issue occurred while installing 14.1.4 onwards for me. For the time being using version 14.1.0 will do the job I guess

I’m getting the same issue, thought it was my npm or node.