I want to learn Next.js, however when I create an empty Next.js project, I can't connect to my localhost when I run npm run dev
. I am doing the following:
npx create-next-app@latest
cd project-name
npm run dev
This is all I see in the command prompt and after the last info-message, the server closes. I don't think my Next.js server starts correctly because it skips to a new line after I run npm run dev
.
PS C:\Users\Username\Documents\Programmering\next13-experiment> npm run dev
next13-experiment@0.1.0 dev
next dev -p 3000
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
warn - You have enabled experimental feature (appDir) in next.config.js.
info - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
info - Using wasm build of next-swc
PS C:\Users\Username\Documents\Programmering\next13-experiment> npx create-next-app@latest --experimental-app
I tried to check if there was any process using the port 3000 through netstat -ano | findstr :3000
, but there was not. I couldn't find any in the Firewall Inbound Rules either.
I tried to Disable Firewall or any antivirus.
I adding 127.0.0.1 localhost
to C:\Windows\System32\drivers\etc\hosts and restart my PC.
I tried to change the port in the package.json.
Windows 10, Node v18.15.0, Next 13.3.0, Not using any VPN
The solution was to uninstall Node v18.15.0, install Node v18.16.0, and then restart my PC. After doing this, the issue was resolved.