简体   繁体   English

Next dev 成功运行,但继续在浏览器上加载

[英]Next dev successfully runs, but keeps loading on browser

Running yarn dev always runs successfully as shown in my vs code terminal:运行yarn dev始终成功运行,如我的 vs code 终端所示:

$ yarn dev
yarn run v1.22.19
warning ..\..\..\..\package.json: No license field
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from C:\Users\Jesti\OneDrive\Desktop\projects\vallendra-portfolio\.env.local
event - compiled client and server successfully in 5.1s (540 modules)
wait  - compiling / (client and server)...
event - compiled client and server successfully in 1963 ms (548 modules)
wait  - compiling...
event - compiled client and server successfully in 1913 ms (540 modules)

it even recompiles successfully whenever there is a code change, but somehow when i try to access localhost:3000 , the browser always stays in this endless loading state.每当有代码更改时,它甚至都能成功重新编译,但不知何故,当我尝试访问localhost:3000时,浏览器始终处于这种无休止的加载状态 state。

here is my dependencies list:这是我的依赖项列表:

"dependencies": {
    "@giscus/react": "^2.2.6",
    "@material-tailwind/react": "^1.2.5",
    "@vercel/og": "^0.0.27",
    "mongoose": "^6.8.4",
    "next": "^13.1.5",
    "next-cloudinary": "^1.11.0",
    "next-themes": "^0.2.1",
    "nextjs-progressbar": "^0.0.16",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-icons": "^4.6.0",
    "swr": "^2.0.1"
  },
  "devDependencies": {
    "@tailwindcss/line-clamp": "^0.4.2",
    "@types/node": "18.11.18",
    "@types/react": "^18.0.17",
    "@types/react-dom": "^18.0.6",
    "autoprefixer": "^10.4.12",
    "postcss": "^8.4.18",
    "prettier": "^2.8.3",
    "prettier-plugin-tailwindcss": "^0.2.1",
    "tailwind-scrollbar": "^2.0.1",
    "tailwindcss": "^3.1.8",
    "typescript": "^4.6.4"
  }

I tried restarting my browser and PC.我尝试重新启动浏览器和 PC。

I tried reinstalling all my dependencies and even tried to downgrade to next 12.3.0 , since i used next 13.1.5 in my package.json .我尝试重新安装所有依赖项,甚至尝试降级到next 12.3.0 ,因为我在我的package.json中使用了next 13.1.5

I tried deleting the.next folder multiple times.我尝试多次删除 the.next 文件夹。 none of those worked.这些都没有用。

yarn build and yarn start seems fine though. yarn buildyarn start看起来不错。 Any help regarding this problem would be much appreciated, thank you.非常感谢有关此问题的任何帮助,谢谢。

Turns out the problem wasn't about the dependencies, some random next.js error, or the browser.事实证明,问题不在于依赖项、一些随机的 next.js 错误或浏览器。

It was my code regarding mongoose/mongodb.这是我关于 mongoose/mongodb 的代码。 In one of my server side.ts file at a certain part of the code that included a query to mongodb, I forgot to make the connection to the database and so the server sort of just hangs (this is just my speculation).在我的一个 server side.ts 文件中,代码的某个部分包含对 mongodb 的查询,我忘记建立与数据库的连接,因此服务器有点挂起(这只是我的猜测)。

After I added the code for checking the connection at that part, the dev server runs normally again.在我在那部分添加检查连接的代码后,开发服务器再次正常运行。

If you've tried the solutions given by others and still doesn't work.如果您已经尝试了其他人提供的解决方案,但仍然无效。 There is probably something in your code that you've done recently that blocks the server thread.您最近在代码中执行的某些操作可能会阻塞服务器线程。

That was my problem, it's probably yours too.那是我的问题,它可能也是你的。

Try using npm and use the following npm command尝试使用 npm 并使用以下 npm 命令

npm run dev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 接下来运行 dev 编译成功,但是 localhost 没有加载 - Next run dev compiled successfully, but localhost is not loading 反应开发工具未在 Chrome 浏览器中加载 - react dev tools not loading in Chrome browser Next.js 保持当前页面处于活动状态并重新渲染,同时下一页的 getInitialProps 完成加载 - Next.js keeps current page active and re-rendering while getInitialProps of next page finishes loading Quill-blot-formatter 未在通过 next/dynamic 导入时向 react-quill 注册,并一直显示加载 - Quill-blot-formatter is not registering with react-quill on import through next/dynamic and keeps showing loading ChunkLoadError:加载块 node_modules_next_dist_client_dev_noop_js 失败 - ChunkLoadError: Loading chunk node_modules_next_dist_client_dev_noop_js failed 将组件传递给 react 中的 app.js 文件时,它会编译,但浏览器会继续加载并且不显示任何内容 - When passing a component to the app.js file in react, it compiles but the browser keeps loading and doesnt show anything “npm run dev”有效,但“next dev”无效 - "npm run dev" works, but "next dev" does not Redux-persist 持续加载 - Redux-persist keeps on loading react-loading-skeleton持续加载 - react-loading-skeleton keeps on loading 加载微调器永远加载 - loading spinner keeps loading forever React
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM