I have a GM script that contains the following:
...
// @grant GM_addStyle
...
// @resource css my.css
...
GM_addStyle(GM_getResourceText('css')) // the error occurs here
...
GM threw out this script from its config.xml
(that happens occasionally) recently, so:
/*.OLD
,*.css
, etc.) from *.OLD
to the new script folder, except the script file (<name>.user.js
) itself,/*.OLD/<name>.user.js
to the newly created script file.Now it runs again but throws an:
Error: No resource with name "css"
Why this? The resource is declared above and it exists in the script's folder. (There's also no upper/lower case difference between the declaration and the actual file name.)
UPDATE
Windows 7 Prof. SP 1 (64-Bit), FF 56.0.2 (64-Bit), GM 3.17
Greasemonkey, pre version 4, didn't just go by the xml file. It also used a *.db
file, and also scanned the scripts folder on startup. It hasn't been necessary to mess with either config file for years.
Anyway, the method from the question is just about the only way to reinstall a script that didn't work on that GM version. You usually can't just copy a @require
or @resource
back on corrupted config. Greasemonkey remains confused.
This should fix it:
*.user.js
file, ensure that all files that are @require
d or @resource
d, locally, are present.@require
or @resource
path points to a viable server path, then the file need not be on the local drive (Greasemonkey will refetch it, once, on script install).*.user.js
file onto Firefox. This should prompt it to install the script.Extra credit: Since the current versions of Firefox (57+) and Greasemonkey (4+) are severely crippled and dysfunctional, consider migrating to Tampermonkey and a better browser. In fact, Greasemonkey itself recommends migrating to Tampermonkey or Violentmonkey.
So far, I've found the UR Browser to be both the most extensible and stable, without the evil "grabbyness" of Chrome. (Opera breaks more scripts/extensions; Vivaldi is promising but buggy; Others have assorted issues.)