Abh*_*ngh 6 npm reactjs next.js sharp nextjs-image
我正在尝试在我的公司系统上使用 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
Run Code Online (Sandbox Code Playgroud)
这可能是因为出于安全原因,我的系统终端上阻止了 github URL。有没有办法在不从github中获取的情况下安装sharp?我可以在浏览器上访问 GitHub,所以如果从那里下载文件然后以某种方式安装它是可能的,我可以这样做。
操作系统:Windows 10
小智 8
我有同样的错误。这件事发生在我身上,因为我有 Apple M1 Mac。我解决了安装 Homebrew 的错误,之后我必须使用Brew install vips. 然后,在我的项目中,npm install sharp最后,我运行npm run build并且它对我来说效果很好。我希望这个对你有用!
| 归档时间: |
|
| 查看次数: |
3883 次 |
| 最近记录: |