gpt4 book ai didi

reactjs - 在没有 GitHub fetch 的情况下为 Nextjs : Error: Cannot find module 'sharp' 安装sharp

转载 作者:行者123 更新时间:2023-12-03 13:49:27 25 4
gpt4 key购买 nike

我正在尝试在我的公司系统上使用 Next.js,但是每当我运行“npm run build”时,构建都会失败并显示以下消息:Error: Cannot find module 'sharp'我尝试安装sharp,但出现此错误:

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.5/libvips-8.10.5-win32-x64.tar.br 
ERR! sharp getaddrinfo ENOTFOUND github.com
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
这可能是因为出于安全原因,我的系统终端上阻止了 github URL。有没有办法在不从github中获取的情况下安装sharp?我可以在浏览器上访问 GitHub,所以如果从那里下载文件然后以某种方式安装它是可能的,我可以这样做。
操作系统:Windows 10

最佳答案

更新 : NextJS v10.0.8 修复了 this issue !如果您遇到上述错误:升级到 10.0.8(或更高版本)。
NextJS sharp 引入的必需 10.0.5 依赖破坏了依赖于底层 libvips 的构建,这在各种 Linux 发行版中都不存在。他们正在努力使依赖项成为可选的。相关公关 herehere 。相关问题 here 。这可能比尝试在您的机器上安装或编译 libvips 更容易(我根本无法让它在我的基于 Amazon EC2 ARM 的机器上运行)。在此期间,您可以降级到 NextJS 10.0.3。我想他们很快就会修复它。

关于reactjs - 在没有 GitHub fetch 的情况下为 Nextjs : Error: Cannot find module 'sharp' 安装sharp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65894000/

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