Why does my manifest.json file is having trouble compiling? - google-chrome-extension

Is there anything that I am doing wrong?
{
"manifest_version": 2,
"name": "somerandomname",
"version": "2.0",
"homepage_url": "https://url.com",
"author": "somedude",
"description": "extension"
},
"icons": {
"48": "img/icon.svg",
"96": "img/icon.svg"
},
The error in jsonlint is,
Error: Parse error on line 8:
...tion": "extension"},"icons": { "48":
----------------------^
Expecting 'EOF', got ','

The "icons" field should be a part of the main object, not a separated entity:
{
"manifest_version": 2,
"name": "somerandomname",
"version": "2.0",
"homepage_url": "https://url.com",
"author": "somedude",
"description": "extension",
"icons": {
"48": "img/icon.svg",
"96": "img/icon.svg"
}
}

Related

Is there a limitation of using web_accessible_resources locally in developer mode in a chrome extension?

Invalid value for 'web_accessible_resources[0]'.
Could not load manifest.
Following the docs from chrome: https://developer.chrome.com/docs/extensions/mv3/manifest/web_accessible_resources/
I ended up with a manifest like this:
{
"name": "MyExt",
"version": "0.0.2",
"description": "Add to MyExt",
"manifest_version": 3,
"web_accessible_resources": [
"images/*.png"
],
"permissions": [
"activeTab",
"cookies",
"declarativeContent",
"storage"
],
"host_permissions": [
"https://www.MyExt.com/"
],
"background": {
"service_worker": "background.js"
},
"action": {
"default_popup": "index.html",
"default_icon": {
"16": "images/logo.png",
"32": "images/logo.png",
"48": "images/logo.png",
"128": "images/logo.png"
}
},
"icons": {
"16": "images/logo.png",
"32": "images/logo.png",
"48": "images/logo.png",
"128": "images/logo.png"
}
}
But i cannot test this in developer mode as this below keeps throwing the error quoted at the top:
"web_accessible_resources": [
"images/*.png"
],
I have tried using an exact path and all wildcards, a path just to the manifest file. Also tried using a path which is relative to the root of the linux filesystem.. but no matter what i do i get the error.

how to setup chrome-extension cookie permission

I have a manifest
{
"name": "Question Share",
"version": "1.0",
"description": "Build an awesome world!",
"permissions": [
"cookies",
"*://*.google.com"
],
"options_page": "options.html",
"background": {
"scripts": [
"background.js"
],
"persistent": false
},
"page_action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
}
},
"icons": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
},
"manifest_version": 2
}
with cookies permission. But, when I load unpacked extension in Chrome
Detail tab always show "This extension requires no special permissions"
I'm flowing document: https://developer.chrome.com/docs/extensions/reference/cookies/
how to call: chrome.cookies.getAllCookieStores
please help!

content script isn't running in chrom extension

I created a Chrom extension.
Among the things the extension suppose to do is to run a script in the context of the page after the page loaded.
For some reason, the script isn't running and I'm not sure what am I doing wrong.
Here's the manifest.json
{
"name": "extension sample",
"version": "1.2",
"description": "some desc",
"manifest_version": 2,
"author": "",
"permissions": ["declarativeContent", "storage", "tabs", "activeTab", "https://*/*", "http://*/*"],
"background": {
"scripts":
["background.js" ],
"persistent": false
},
"content_scripts": [
{ "run_at" :"document_end",
"matches": ["https://*/*""],
"js": ["snippet.js"],
"all_frames": true
} ],
"web_accessible_resources":["snippet.js"],
"content_security_policy": "script-src 'self' https://www.google.com; object-src 'self'",
"browser_action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
}
},
"icons": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
}
}
This is the code that runs the script:
chrome.tabs.query({currentWindow: true, active: true}, function (tab) {
chrome.tabs.executeScript(tab.id, {
file: 'snippet.js'
});
});
I just placed the script execution instead of the reload method just to focus on the script execution.
So my question is, why is the script not running?

Chrome Extension Manifest permissions blocked

I got sucked with this issues while trying to upgrade my extension on Chrome Store. I tried all recommended solutions without success. Can someone help please?This is what I got from Chrome Store
This is my Manifest file:
{
"name": "__MSG_appName__",
"version": "{{version}}",
"manifest_version": 2,
"description": "__MSG_appDescription__",
"icons": {
"16": "images/icon-16.png",
"19": "images/icon-19.png",
"32": "images/icon-32.png",
"38": "images/icon-38.png",
"48": "images/icon-48.png",
"64": "images/icon-64.png",
"128": "images/icon-128.png"
},
"default_locale": "en",
"background": {
"scripts": [ ]
},
"browser_action": {
"default_icon": {
"16": "images/icon-16.png",
"19": "images/icon-19.png",
"32": "images/icon-32.png",
"38": "images/icon-38.png",
"48": "images/icon-48.png",
"64": "images/icon-64.png",
"128": "images/icon-128.png"
},
"default_title": "..."
},
"content_scripts": [
{
"name": "main_scripts",
"matches": [
"http://*/*",
"https://*/*"
],
"css": []
"run_at": "document_start",
"all_frames": false
}
],
"permissions": [
"activeTab",
"contextMenus",
"history",
"storage",
"management",
"webRequest",
"webRequestBlocking"
]
}
I don't know if this could help. This is what I get in development environment:
Error from chrome://extension 1,
Error from chrome://extension 2

Bower install display prompt input message debian

I am getting a problem trying to execute a bower install on my project
I am just executing bower install command on my debian OS
but when this is recognizing the dependencies defined on my bower.json.
its got stuck in a part that I dont understand
this is the last part that i see in my command line
"dependencies": {
"angular": {
"endpoint": {
"name": "angular",
"source": "angular",
"target": "^1.0.8"
},
"canonicalDir": "/home/ricco/.cache/bower/packages/060a9fe0e60a0d3d6c9ed350cde03e61/1.5.4",
"pkgMeta": {
"name": "angular",
"version": "1.5.4",
"license": "MIT",
"main": "./angular.js",
"ignore": [],
"dependencies": {},
"homepage": "https://github.com/angular/bower-angular",
"_release": "1.5.4",
"_resolution": {
"type": "version",
"tag": "v1.5.4",
"commit": "b972d5aa130bef5c4d931f22bd11627207ea35ca"
},
"_source": "https://github.com/angular/bower-angular.git",
"_target": ">=1"
},
"dependencies": {},
"nrDependants": 1
}
},
"nrDependants": 1
}
]
}
]
}
}, {
"type": "input",
"message": "Answer",
"name": "prompt",
"level": "prompt"
then there after dislpaying the
{
"type": "input",
"message": "Answer",
"name": "prompt",
"level": "prompt"
it got stuck there for some reason.
This is my bower.json
{
"name": "ng-boilerplate",
"version": "0.3.2",
"devDependencies": {
"angular": "~1.2",
"angular-mocks": "~1.2",
"bootstrap": "~3.1",
"angular-bootstrap": "~0.10.0",
"angular-ui-router": "~0.2",
"angular-route":"1.5.3",
"angular-resource":"1.5.3"
},
"dependencies": {}
}
I experienced the same issue using the Angular boilerplate ngbp.
I solved the issue by removing the following line from my .bowerrc file:
"json": "bower.json"
Alternatively, see the answer below by #NikolaB. which involves adding resolutions to your bower.json instead of removing this line.
When you specify dependencies for your app via Bower, some of the packages might rely on different versions of the same library. You will have to resolve what version of libraries you want in your app.
If you configure you Bower using "json": "bower.json" inside .bowerrc file, Bower will expect those resolutions to be inside bower.json file. This means that you must have "resolutions" property inside bower.json file.
So, you could try adding "resolutions" property into your bower.json:
{
"name": "ng-boilerplate",
"version": "0.3.2",
"devDependencies": {
"angular": "~1.2",
"angular-mocks": "~1.2",
"bootstrap": "~3.1",
"angular-bootstrap": "~0.10.0",
"angular-ui-router": "~0.2",
"angular-route":"1.5.3",
"angular-resource":"1.5.3"
},
"resolutions": {
"angular": "1.2.12"
}
}

Resources