Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME] on Windows Using [npm run dev] #64372

Closed
Ahmed-Elgendy25 opened this issue Apr 11, 2024 · 26 comments
Closed
Labels
bug Issue was opened via the bug report template. locked

Comments

@Ahmed-Elgendy25
Copy link

Ahmed-Elgendy25 commented Apr 11, 2024

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

@Ahmed-Elgendy25 Ahmed-Elgendy25 added the bug Issue was opened via the bug report template. label Apr 11, 2024
@jayxd-com

This comment has been minimized.

@DivineDemon
Copy link

When creating a Next App using create-next-app@latest, the app gets created using the Next v14.2.0. But this has the above issue, I tried downgrading next to v14.1.4 using npm i next@14.1.4 but to no avail. The issue still persists.

@campbell-frost
Copy link

campbell-frost commented Apr 12, 2024

same errors using yarn add create-next-app and then npm run dev for me

@Mikoyzskie
Copy link

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

@Shank0071
Copy link

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

@elmerdotdev
Copy link

elmerdotdev commented Apr 12, 2024

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

@jthomazini
Copy link

I have the same error; I have just installed node js and created the Nextjs app with npx create-next-app@latest
Need to install the following packages:
create-next-app@14.2.0
Ok to proceed? (y)
√ What is your project named? ... hello-world
√ Would you like to use TypeScript? ... No / Yes
√ Would you like to use ESLint? ... No / Yes
√ Would you like to use Tailwind CSS? ... No / Yes
√ Would you like to use src/ directory? ... No / Yes
√ Would you like to use App Router? (recommended) ... No / Yes
√ Would you like to customize the default import alias (@/*)? ... No / Yes
Creating a new Next.js app in D:\Development\VSC\Nextjs\course\hello-world.

added 360 packages, and audited 361 packages in 1m

133 packages are looking for funding
run npm fund for details

found 0 vulnerabilities
Success! Created hello-world at D:\Development\VSC\Nextjs\course\hello-world

npm run dev

hello-world@0.1.0 dev
next dev

▲ Next.js 14.2.0

✓ Starting...
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
✓ Ready in 7.1s

I have disabled telemetry:
npx next telemetry disable

Then I tried again:
npm run dev

hello-world@0.1.0 dev
next dev

▲ Next.js 14.2.0

✓ Starting...
✓ Ready in 1446ms

And then I got the error:

src\app\layout.tsx
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)

@jorchsg
Copy link

jorchsg commented Apr 12, 2024

Here is a temprary solution.

#64371 (comment)

@automatefreely
Copy link

This actually works

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

@Azoonex
Copy link

Azoonex commented Apr 12, 2024

There is no next version 14 yet
You can from
use npx create-next-app@14.1.0

@HOTLancerX
Copy link

update Node.js v21.7.3

@Ahmed-Elgendy25
Copy link
Author

Here is a temprary solution.

#64371 (comment)

This solution is working, Thank you

@robiuzzaman4
Copy link

robiuzzaman4 commented Apr 12, 2024

After creating a next app by using npx create-next-app@latest command, the app gets created using the next js v14.2.0. But it has the above issue. Now I fixed this issue by following this temporary solution. 👉#64371 (comment)

@timneutkens
Copy link
Member

Closing as duplicate of #64371

@cassiossantos
Copy link

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

Tks! Worked for me.

@Joshua-takyi
Copy link

i even restarted my IDE now i've lost all extensions lol ..i knew everything was working well last night

@Ananyajadon
Copy link

even i create a new project and tried to change the location of every folder still this error showing

@Azoonex
Copy link

Azoonex commented Apr 12, 2024

You Can install v @14.1.0
and continue until is completely stable

@yeabnoah
Copy link

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.

@Arghya003
Copy link

using npx create-next-app@14.1.0 . is actually working. I dont why this error is occurring. anyone got a clue?

@HamzaAmar
Copy link

It' s happen to me also at the first it work correctly but after I change the font the error occur ??

@Azoonex
Copy link

Azoonex commented Apr 13, 2024

The latest version has a problem that the developers of Next are dealing with. Please change the version
npx create-next-app@14.1.0

@mohammadrezagohari
Copy link

mohammadrezagohari commented Apr 14, 2024

14.2.0 version still has this error

@nabilashbat
Copy link

nabilashbat commented Apr 15, 2024

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

@Balyeet1
Copy link

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

Im using 14.2.0-canary.66 Next version, and this worked for me, thanks.

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

No branches or pull requests