如何修复 NextJS 问题?

Ken*_*ene 7 enoent next.js next-images

你们知道什么可能会导致这个错误吗?我们将非常感谢您的帮助。这个错误突然开始,无法找出原因。我找到的与此主题相关的任何来源也没有帮助,例如 npm 清除缓存等。

error - uncaughtException: Error: ENOENT: no such file or directory, open 'C:\Users\merth\Documents\GitHub\nextjs\.next\cache\images\dGhpP2cdrThITYfJW5zYTASPDxgkrHRsKGV+DHjA9zg=\0.1644007067863.49adoDywz9oh2itwLAOxco3SX+8Yk8UjPaOwcMHXKIw=.webp'
error - uncaughtException: Error: ENOENT: no such file or directory, open 'C:\Users\merth\Documents\GitHub\nextjs\.next\cache\images\4XzO9vkSresQcu4SX685Pbl3Cb8+GLnoRVSy6EWXt5Y=\0.1644007067864.yV8JGEcK4N5RHfOP1YCy50EVKU0ZtA8shhISYdcO9cQ=.webp'
error - uncaughtException: Error: ENOENT: no such file or directory, open 'C:\Users\merth\Documents\GitHub\nextjs\.next\cache\images\P0c16eKt464UeqAGlMPK9QsWSCanffokfdynMp877IQ=\0.1644007067876.CuEqtaf2wyvhSmvWM7JEkbGjhFFUEs9KqFQ-2+tjghc=.webp'
error - uncaughtException: Error: ENOENT: no such file or directory, open 'C:\Users\merth\Documents\GitHub\nextjs\.next\cache\images\-Q0UZI-9z63T0kTLDD9WriKzJMRU4ezA+i4LmDQDXlM=\0.1644007067831.UiZIuijWkV1W07Pfo02XjEvnKc-DlxzW0O3wLCqz-hM=.webp'
error - uncaughtException: Error: ENOENT: no such file or directory, open 'C:\Users\merth\Documents\GitHub\nextjs\.next\cache\images\INra01gHa2-vzBW63AhvPMn+t5fHxh8cp5pivirhiRA=\0.1644007067837.NvV+tAwZT5uhgQUBvxIUsk1gLqUnDgarmgOlSAv2Oos=.webp'
error - uncaughtException: Error: ENOENT: no such file or directory, open 'C:\Users\merth\Documents\GitHub\nextjs\.next\cache\images\5IOk0AWjSzsxeWX3JUtAxUOeibv3HkY1OaLS3xWD1P0=\0.1644007067823.BNmZ25sRS8r8aebBo4tpl77uOHrZp-hK7huYDJCA2YI=.webp'
Run Code Online (Sandbox Code Playgroud)

我的一些图像组件;

<figure className='w-full h-full overflow-hidden bg-white rounded-sm lg:rounded-r-none'>
     <div className='relative w-full h-full transition-transform lg:group-hover:scale-105 transform-gpu'>
           {props.page.card.thumbnail && (
                 <>
                     <Image
                         layout='fill'
                         // width={752}
                         // height={490}
                         objectFit='cover'
                         objectPosition='center'
                         src={props.page.card.thumbnail}
                         alt={
                             props.page.card.title && 
                             props.page.card.title[props.locale]
                             }
                         loading='lazy'
                         placeholder='blur'
                         blurDataURL={props.page.card.thumbnail}
                         quality={75}
                      />
                    </>
             )}
    </div>
</figure>
Run Code Online (Sandbox Code Playgroud)

--

"dependencies": {
        "@google/model-viewer": "^1.10.1",
        "@tailwindcss/aspect-ratio": "^0.4.0",
        "@tailwindcss/forms": "^0.4.0",
        "@tailwindcss/line-clamp": "^0.3.1",
        "autoprefixer": "^10.4.2",
        "eslint": "7.32.0",
        "eslint-config-next": "^0.2.4",
        "js-cookie": "^3.0.1",
        "next": "^12.0.10",
        "nprogress": "^0.2.0",
        "postcss": "^8.4.5",
        "react": "^17.0.2",
        "react-accessible-accordion": "^4.0.0",
        "react-dom": "^17.0.2",
        "react-share": "^4.4.0",
        "react-social-icons": "^5.10.0",
        "serverless-mysql": "^1.5.4",
        "sharp": "^0.30.0",
        "swr": "^1.2.1",
        "tailwindcss": "^3.0.13",
        "tailwindcss-animation-delay": "^1.0.7"
    },
Run Code Online (Sandbox Code Playgroud)

Ric*_*ira 10

我遇到了同样的问题,就我而言,我只是尝试一下:

\n

PS. this fix is not permanent, this is just a stopgap solution

\n
    \n
  1. \n
      \n
    • 停止本地服务器
    • \n
    \n
  2. \n
  3. \n
      \n
    • 删除文件夹.next
    • \n
    \n
  4. \n
  5. \n
      \n
    • 运行yarn dev(我在项目中使用 Yarn 包)
    • \n
    \n
  6. \n
\n

Voil\xc3\xa0,问题解决。

\n

  • 这立即为我解决了这个问题!一定是某种媒体项目的缓存/获取问题。 (2认同)

Eri*_* Er 0

尝试将“下一步”恢复到 12.0.9

"next": "^12.0.9",
Run Code Online (Sandbox Code Playgroud)

解决方案来自这里 https://github.com/vercel/next.js/issues/33860

  • 已经试过了,没用。 (2认同)