我试图在我的公司系统上使用Next.js,但是每当我运行"npm“时,这个构建就会失败,并发出这样的消息: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
发布于 2021-02-05 15:17:48
发布于 2021-01-29 13:00:41
我也犯了同样的错误。这件事发生在我身上,因为我有苹果的M1电脑。我解决了安装Homebrew的错误,之后,我不得不使用Brew install vips安装'lipvips‘。然后,在我的项目npm install sharp中,最后,我运行npm run build,它对我来说很好。我希望它对你有用!
发布于 2021-06-02 15:28:11
我在mac m1上也有同样的问题。我将节点版本降为14,现在它可以工作了。
https://stackoverflow.com/questions/65894000
复制相似问题