英文:
The "default_icon: {}" isn't working in my manifest.json
问题
manifest.json 在我运行时一直报错。 文件夹中包含与相应名称相符的所有图像文件。
未能加载扩展
文件 ~\Downloads\MyExtension
错误 Manifest 不是有效的 JSON。行:10,列:3,语法错误。
{
"name": "计算器扩展",
"version": "1.0.0",
"description": "一个简单的计算器,帮助您解决生活中的问题!",
"manifest_version": 3,
"author": "Mippy",
"action": {
"default_popup": "index.html",
"default_title": "计算器"
"default_icon": {
"16": "favicon16.png",
"32": "favicon32.png"
}
}
"icons": {
"16": "favicon16.png",
"32": "favicon32.png",
"48": "icon48.png",
"128": "icon128.png"
}
}
此外,错误不是由于缩进,我已经尝试过了。
我尝试过:
- 确保图像名称与清单匹配并位于文件夹中。
- 重新排列代码
我期望扩展会包含这些图像,但结果是上述错误。
英文:
The manifest.json keeps giving me this error when I run it. All the image files with the corresponding names are in the folder.
Failed to load extension
File ~\Downloads\MyExtension
Error Manifest is not valid JSON. Line: 10, column: 3, Syntax error.
{
"name": "Calculator Extension",
"version": "1.0.0",
"description": "A simple calculator to help you in life!",
"manifest_version": 3,
"author": "Mippy",
"action": {
"default_popup": "index.html",
"default_title": "Calculator"
"default_icon": {
"16": "favicon16.png",
"32": "favicon32.png"
}
}
"icons": {
"16": "favicon16.png",
"32": "favicon32.png",
"48": "icon48.png",
"128": "icon128.png"
}
}
Also, the error isn't the spacing, I already tried that.
I tried:
- Making sure the image names matched with the manifest and were in the folder.
- Rearranging the code
I was expecting that the extension would have the images, however it resulted in the error above.
答案1
得分: 1
你错过了在"default_title"一行后面加逗号,也是在"actions"对象的末尾加逗号。请尝试以下修正:
{
"name": "Calculator Extension",
"version": "1.0.0",
"description": "A simple calculator to help you in life!",
"manifest_version": 3,
"author": "Mippy",
"action": {
"default_popup": "index.html",
"default_title": "Calculator",
"default_icon": {
"16": "favicon16.png",
"32": "favicon32.png"
}
},
"icons": {
"16": "favicon16.png",
"32": "favicon32.png",
"48": "icon48.png",
"128": "icon128.png"
}
}
你可以使用在线JSON验证工具来验证你的JSON,比如这个 - https://jsonformatter.curiousconcept.com/。
英文:
you missed a comma sign after line "default_title": "Calculator" and also after end of "actions"
object. Try this:
{
"name": "Calculator Extension",
"version": "1.0.0",
"description": "A simple calculator to help you in life!",
"manifest_version": 3,
"author": "Mippy",
"action": {
"default_popup": "index.html",
"default_title": "Calculator",
"default_icon": {
"16": "favicon16.png",
"32": "favicon32.png"
}
},
"icons": {
"16": "favicon16.png",
"32": "favicon32.png",
"48": "icon48.png",
"128": "icon128.png"
}
}
there are online JSON validators you can use to validate issues with your JSON, like this one - https://jsonformatter.curiousconcept.com/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论