yarn的安装
yarn global add @gridsome/cli
npm的安装
npm install --global @gridsome/cli
sharp的库所在位置:https://github.com/lovell/sharp
sharp的官方网址:https://sharp.pixelplumbing.com
在官网中找到安装

选择Chinese mirror

npm config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
npm config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
建立站点
gridsome create my-gridsome-site
如果安装失败,删除node_modules,用cnpm
npm i
如果执行结果是
⚠ connect ECONNREFUSED 0.0.0.0:443
⚠ cwebp pre-build test failed
ℹ compiling from source
✔ cwebp built successfully
需要打开:https://github.com/googlehosts/hosts,下载demo,拷贝解压文件夹里面的hosts文件
在终端中执行(Mac电脑)
open /etc
将hosts粘贴到etc文件夹,替换掉原来的hosts文件。
gridsome develop

本文档详细介绍了如何安装Yarn和npm,特别是针对sharp库,提供了中国镜像的设置方法以加速下载。在遇到安装失败时,建议尝试使用cnpm重新安装。此外,对于安装过程中出现的网络连接问题,可以通过替换hosts文件来解决。最后,展示了如何使用Gridsome创建和启动站点。

1017

被折叠的 条评论
为什么被折叠?



