Chrome扩展程序清单返回错误 [英] Chrome Extension Manifest Returns Error

查看:504
本文介绍了Chrome扩展程序清单返回错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论我做什么,清单都会返回以下错误:

 无法从
'加载扩展名/应用/ XAMPP / xamppfiles / htdocs中/实验室/铬/测试。清单不是有效的JSON。
行:28,列:2,不允许使用尾随逗号。

但是我从Chrome托管的开发站点引用并复制了它。我陷入了第一步。以下是我的清单:

  {

manifest_version:2,
name :同一延伸,
版本:1,

default_locale:en,
description:描述,



content_scripts:[
{
匹配:[http://www.google.com/*],
css:[mystyles.css],
js:[jquery.js,myscript.js]
}
],

}

我引用的Chrome文档: Here & 这里

解决方案



content_scripts 数组末尾取消逗号,而不是:

 content_scripts:[
{
matches:[http://www.google .com / *],
css:[mystyles.css],
js:[jquery.js,myscript.js]
}
],

试试:

 content_scripts:[
{
matches:[http://www.google.com/*],
css :[mystyles.css],
js:[jquery.js,myscript.js]
}
]


No matter what I do, the manifest returns the following error:

 Could not load extension from 
 '/Applications/XAMPP/xamppfiles/htdocs/lab/chrome/test'. Manifest is not valid JSON.
 Line: 28, column: 2, Trailing comma not allowed.

But I have referred and copied it from the dev site hosted by chrome. I am stuck in the very first step. Below is my manifest

{

  "manifest_version": 2,
  "name": "Same Extention",
  "version": "1",

  "default_locale": "en",
  "description": "A description",



 "content_scripts": [
    {
      "matches": ["http://www.google.com/*"],
      "css": ["mystyles.css"],
      "js": ["jquery.js", "myscript.js"]
    }
  ],

}

Chrome Documentations I referred: Here & Here

解决方案

Remove the comma at the end of your content_scripts array.

Instead of:

"content_scripts": [
    {
      "matches": ["http://www.google.com/*"],
      "css": ["mystyles.css"],
      "js": ["jquery.js", "myscript.js"]
    }
  ],

Try:

"content_scripts": [
    {
      "matches": ["http://www.google.com/*"],
      "css": ["mystyles.css"],
      "js": ["jquery.js", "myscript.js"]
    }
  ]

这篇关于Chrome扩展程序清单返回错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆