先下载nodejs,再安装picgo,最后配置typora
下载nodejs:https://nodejs.org/en/download/current/ (选择.pkg后缀的64-bit/ARM64,默认安装)
去gitee申请一个账户并新建一个仓库,得到一个token
打开终端
# 输入 which node 可以查看刚刚nodejs安装位置
(base) yudd@ydduongs-MacBook-Air ~ % which node
/usr/local/bin/node
# 安装picgo(之后输入密码): sudo npm install picgo -g
(base) yudd@ydduongs-MacBook-Air ~ % sudo npm install picgo -g
Password:
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
added 454 packages, and audited 455 packages in 28s
10 packages are looking for funding
run `npm fund` for details
3 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
# 查看picgo安装位置
(base) yudd@ydduongs-MacBook-Air ~ % which picgo
/usr/local/bin/picgo
# 安装gitee插件
(base) yudd@ydduongs-MacBook-Air ~ % picgo install gitee-uploader
added 4 packages, and audited 5 packages in 3s
found 0 vulnerabilities
[PicGo SUCCESS]: 插件安装成功
# 配置插件属性: 只需要注意repo是用户名/仓库名(是仓库网址的后两个关键字),token是仓库令牌,其他可以直接回车,不用设置
(base) yudd@ydduongs-MacBook-Air ~ % picgo set uploader
? Choose a(n) uploader gitee
? repo: yddhhhg/markdown-img
? branch: master
? token: bc48xxxxxxxxxxxxxxxxx9f49260
? path:
? customPath: default
? customUrl:
[PicGo SUCCESS]: Configure config successfully!
# 选择默认gitee为默认图床
(base) yudd@ydduongs-MacBook-Air ~ % picgo use uploader
? Use an uploader gitee
[PicGo SUCCESS]: Configure config successfully!
配置Typora
- 选择上传图片(Upload image)
- 勾选应用于本地图片(Apply above rules to local images)
- Image Upload选择Custom Command
- Command输入:node路径 picgo路径 upload(/usr/local/bin/node /usr/local/bin/picgo upload)
- 之后点击Test Upload,验证是否可以