“default_icon: {}” 在我的 manifest.json 中不起作用。

huangapple go评论69阅读模式
英文:

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"
  }
}

此外,错误不是由于缩进,我已经尝试过了。

我尝试过:

  1. 确保图像名称与清单匹配并位于文件夹中。
  2. 重新排列代码

我期望扩展会包含这些图像,但结果是上述错误。

英文:

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:

  1. Making sure the image names matched with the manifest and were in the folder.
  2. 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/

huangapple
  • 本文由 发表于 2023年2月14日 20:46:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/75448058.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定