Typora自带的picgo图床上传功能 异常修复

Typora集成的基于picgo的图床上传功能 异常修复

关键错误信息: SyntaxError: Malformed JSON in file: C:\Users\seane/.picgo/config.json, line: 6, column: 0

现象

用的好好的typora picgo图床,有一天突然用不了了。现象如下:

image-20250313164136260

上传图片失败。错误信息: (comand failed: @chcp 65001 >nul & cmd /d/s/c D:\Apppata\Roaming\Typora/picgo/win64/picgo.exe u"o:llseanerllwugrechl imgAl1limage-20250313164021464.png" D: AppatalRoaminglryporalpicgo(win64node modules lowdbladapters filesync.js:42 throw e;A syntaxError: Malformed Isopicso.is:58:19)at new picGo (D;lAppatalRoamingTvporalpicolwin64lnode moduleslpicoldistisrclcorelpicGo is:38:14) atobiect,<anonymous> (p; AppatalRoaminglTvporalpicolwin4lindex,is:13:15)at module, compile (internal/modules/cis/loader is:956:302f line: 6.column:0 }

打开偏好设置的配置选择,进行图片上传验证,也是报错。

image-20250313164340657

@chcp 65001 >nul & cmd /d/s/c D:\AppData\Roaming\Typora\picgo\win64\picgo.exe u "C:\\Users\\seane\\AppData\\Local\\Temp/typora-icon2.png" "C:\\Users\\seane\\AppData\\Local\\Temp/typora-icon.png"
D:\AppData\Roaming\Typora\picgo\win64\node_modules\lowdb\adapters\FileSync.js:42
throw e;
^

SyntaxError: Malformed JSON in file: C:\Users\seane/.picgo/config.json
Unexpected token "
at unexpected (D:\AppData\Roaming\Typora\picgo\win64\node_modules\comment-json\src\parse.js:80:17)
at FileSync.parse [as deserialize] (D:\AppData\Roaming\Typora\picgo\win64\node_modules\comment-json\src\parse.js:361:5)
at FileSync.read (D:\AppData\Roaming\Typora\picgo\win64\node_modules\lowdb\adapters\FileSync.js:37:30)
at LodashWrapper.db.read (D:\AppData\Roaming\Typora\picgo\win64\node_modules\lowdb\lib\main.js:32:21)
at Object.module.exports [as default] (D:\AppData\Roaming\Typora\picgo\win64\node_modules\lowdb\lib\main.js:51:13)
at new DB (D:\AppData\Roaming\Typora\picgo\win64\node_modules\picgo\dist\src\utils\db.js:19:34)
at PicGo.initConfig (D:\AppData\Roaming\Typora\picgo\win64\node_modules\picgo\dist\src\core\PicGo.js:58:19)
at new PicGo (D:\AppData\Roaming\Typora\picgo\win64\node_modules\picgo\dist\src\core\PicGo.js:38:14)
at Object.<anonymous> (D:\AppData\Roaming\Typora\picgo\win64\index.js:13:15)
at Module._compile (internal/modules/cjs/loader.js:956:30) {
line: 6,
column: 0
}

在cmd中单独执行, picgo.exe命令也是同样的错误,关键信息是: SyntaxError: Malformed JSON in file: C:\Users\seane/.picgo/config.json, line: 6, column: 0

image-20250313164021464

因此初步判断 是config.json文件的问题,但是这个文件从来没有修改过,为啥 就突然 用不了了呢。

解决尝试一: 升级picgo.exe

下载并更新picoGo工具,发现问题依旧。

image-20250313163809122

解决尝试二: 修改config.json

修改前:

{
  "picgoPlugins": {
    "picgo-plugin-gitee-uploader": true
  }
}
"gitee": {
      "branch": "master",
      "customPath": "",
      "customUrl": "",
      "path": "xx",
      "repo": "xx/xx",
      "token": "xxxx7"
    }
  },
  "picgoPlugins": {
    "picgo-plugin-gitee-uploader": true,
    "picgo-plugin-super-prefix": true
  },
  "picgo-plugin-gitee-uploader": {
    "lastSync": "2025-03-10 05:35:28"
  }
}

改后:

{
  "picBed": {
    "current": "gitee",
    "gitee": {
      "path": "xxx",
      "repo": "xx/xx",
      "token": "xx",
      "customUrl": ""
    }
  },
  "picgoPlugins": {
    "picgo-plugin-gitee-uploader": true,
    "picgo-plugin-super-prefix": true
  },
  "uploader": "gitee",
  "picgo-plugin-gitee-uploader": {
    "lastSync": "2025-03-13 04:38:14"
  }
}

修改,命令行验证picgo.exe不报错了:

C:\Windows\System32>D:\AppData\Roaming\Typora\picgo\win64\picgo.exe

C:\Windows\System32>

上传图片也正常了:

C:\Windows\System32>D:\AppData\Roaming\Typora\picgo\win64\picgo.exe

C:\Windows\System32>

上传图片也正常了:

image-20250313165259972

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

月光技术杂谈

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值