gpt4 book ai didi

NextJS fast refresh is not working after using official installer(使用官方安装程序后,NextJS快速刷新不起作用)

转载 作者:bug小助手 更新时间:2023-10-25 21:17:02 25 4
gpt4 key购买 nike



I've been wanting to learn Next.js for a while so I decided to give it a try. Following the instructions at their website I ran npx create-next-app@latest on my powershell and waited until the process finished, then cd'd into the folder and ran npm run dev. Once the server opened I went to edit app/page.js just as their README and the default HTML suggests but absolutely nothing updates in my browser. I've tried Chrome, Firefox and Edge with no luck at all.

我想学习Next.js已经有一段时间了,所以我决定试一试。按照他们网站上的说明,我在PowerShell上运行了npx create-Next-app@Latest,并等待该过程完成,然后cd进入文件夹并运行npm run dev。服务器打开后,我去编辑app/page.js,就像他们的自述文件和默认的HTML建议的那样,但在我的浏览器中绝对没有更新。我试过Chrome、Firefox和Edge,但一无所获。


I'm working on latest version of Windows 11, I haven't done any other changes to the project after installing it but just in case I'll share the initialization settings and pyproject below.

我正在使用最新版本的Windows11,安装后我还没有对项目做过任何其他更改,但以防万一我会在下面分享初始化设置和pyproject。


PS E:\Desktop\Dev> npx create-next-app@latest
√ What is your project named? ... nextjs_learn
√ Would you like to use TypeScript? ... No
√ Would you like to use ESLint? ... Yes
√ Would you like to use Tailwind CSS? ... Yes
√ Would you like to use `src/` directory? ... No
√ Would you like to use App Router? (recommended) ... Yes
√ Would you like to customize the default import alias? ... No
Creating a new Next.js app in E:\Desktop\Dev\nextjs_learn.

pyproject.toml

Pyproject.toml


{
"name": "nextjs_learn",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"autoprefixer": "10.4.15",
"eslint": "8.49.0",
"eslint-config-next": "13.4.19",
"next": "13.4.19",
"postcss": "8.4.29",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.3"
}
}


Folder Structure


Am I doing something wrong? The documentation states that Fast Refresh is enabled by default but I seem to be unable to make it work.

我是不是做错了什么?文档指出,默认情况下启用快速刷新,但我似乎无法使其工作。


Thank you!

谢谢!


更多回答
优秀答案推荐

After checking some more issues I updated node.js from 18 to 20 and somehow it worked. Maybe my node.js installation was too busy or idk... anyways I managed to make it work so thank you!

在检查了更多问题后,我将node.js从18更新到20,不知何故它起作用了。也许我的node.js安装太忙或太空闲...无论如何,我设法让它工作,所以谢谢你!


更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com