Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Unexpected token a in JSON at position 1524 #160

Closed
qiuqiao opened this issue Dec 27, 2021 · 7 comments
Closed

bug: Unexpected token a in JSON at position 1524 #160

qiuqiao opened this issue Dec 27, 2021 · 7 comments

Comments

@qiuqiao
Copy link

qiuqiao commented Dec 27, 2021

Environment

TidGi 0.7.1
Electron 15.3.0
win32 10.0.19042
Locale: zh-CN

Description:

报错,提示信息是:
Unhandled Promise Rejection
SyntaxError: Unexpected token a in JSON at position 1524
at JSON.parse ()
at C:/Users/QQ/AppData/Local/TidGi/app-0.7.1/resources/app.asar/.webpack/main/webpack:/TidGi/node_modules/electron-settings/dist/settings.js:227:38
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

Steps to Reproduce:

点击左边的仓库图标,如:下图中的public图标
tmp57C1

Additional Context

SyntaxError: Unexpected token a in JSON at position 1524
    at JSON.parse (<anonymous>)
    at C:\Users\QQ\AppData\Local\TidGi\app-0.7.1\resources\app.asar\.webpack\main\webpack:\TidGi\node_modules\electron-settings\dist\settings.js:227:38
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

操作系统:win10 x64

@qiuqiao
Copy link
Author

qiuqiao commented Dec 27, 2021

尝试重启太记,这个bug又没有了

@Gk0Wk
Copy link

Gk0Wk commented Dec 27, 2021

建议TidGi捕获到JSON解析错误时,能够同时输出json文件路径。

@linonetwo
Copy link
Contributor

其实就是设置json在windows上有时候并行写入会有问题。重启时会修复一波。

@linonetwo
Copy link
Contributor

这个下次遇到可以把 log 也放上来

@linonetwo linonetwo reopened this Dec 27, 2021
@linonetwo
Copy link
Contributor

这是上游库 electron-settings 的锅

@linonetwo
Copy link
Contributor

@linonetwo
Copy link
Contributor

没 log 不好排查

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants