zotero-plugin-template icon indicating copy to clipboard operation
zotero-plugin-template copied to clipboard

zotero not able to find the boostrap methods

Open carljoseph opened this issue 10 months ago • 18 comments

Still having some problems getting the examples running. When I enable/disable the plugin in Zotero, the console says that it can't find the bootstrap methods for startup & shutdown. No doubt I've done something wrong here in my repo?

Screenshot 2024-04-01 at 16 42 36

Thx.

carljoseph avatar Apr 01 '24 05:04 carljoseph

package.json

  "config": {
    "addonName": "Zotero Reporter",
    "addonID": "[email protected]",
    "addonRef": "zotero-reporter",
--  "addonInstance": "Zotero.${addonInstance}",
--  "prefsPrefix": "extensions.zotero.${addonRef}",
++  "addonInstance": "Reporter",
++  "prefsPrefix": "extensions.zotero.reporter",
    "releasePage": "https://github.com/carljoseph/zotero-reporter/releases",
    "updateJSON": "https://raw.githubusercontent.com/carljoseph/zotero-reporter/main/update.json"
  },

northword avatar Apr 01 '24 06:04 northword

https://github.com/carljoseph/zotero-reporter/blob/7dfc936a63c4f64f8d4bf202aaf5d2964285b3f7/package.json#L9-L10

The addonInstance should be a valid JS variable name and addonRef should be a valid CSS and Fluent string

(and prefsPrefix may have limitation to symbols, not sure - but extensions.zotero.${addonRef} is definitely not a good idea, since the string ${addonRef} does not represents your plugin.

windingwind avatar Apr 01 '24 06:04 windingwind

++  "addonInstance": "Reporter",

Emm... Zotero.Reporter might not be a good definition for me. Maybe ReporterPlugin or something that's less likely to cause conflict?

windingwind avatar Apr 01 '24 06:04 windingwind

BTW, the plugin name Zotero Reporter is not a very good idea, since Zotero is a registered trademark and the team suggests plugin developers not to use a name like Zotero XYZ, instead use XYZ for Zotero, to not mislead users that it's an official Zotero software. (The GitHub repo name can be an exception since it's not for users)

windingwind avatar Apr 01 '24 06:04 windingwind

Emm... Zotero.Reporter might not be a good definition for me. Maybe ReporterPlugin or something that's less likely to cause conflict?

Indeed, I was just trying to express that it's here that there is a issue, and ignoring this word easily leads to confusion.

northword avatar Apr 01 '24 06:04 northword

Thanks for your patience and help folks. Have changed the naming of the plugin, etc. but I'm still getting the same console error.

I'm new to this, and basically trying to get the plugin template examples working to get me started. Thx

carljoseph avatar Apr 01 '24 06:04 carljoseph

Already restarted Zotero and dev servers? (kill zotero and re-run npm start)

northword avatar Apr 01 '24 06:04 northword

Yep, indeed. Here's what it looks like (with Zotero not started at the beginning) ...

https://github.com/windingwind/zotero-plugin-template/assets/4588120/5aa71a52-64bf-4e07-b903-bf323fe09a8c

Trying to get these examples running. Happy to admit if this is beyond me at the moment and if there may be a more straightforward way ¯_(ツ)_/¯

carljoseph avatar Apr 01 '24 06:04 carljoseph

image

but it's running for me.

use a beta version zotero?

let me see your build/addon/bootstrap.js ?

northword avatar Apr 01 '24 07:04 northword

Yeah, using the latest beta version of Zotero 7. bootstrap.js is unchanged - https://github.com/carljoseph/zotero-reporter/blob/main/addon/bootstrap.js

All I changed was the config section in the package.json

carljoseph avatar Apr 01 '24 07:04 carljoseph

I guess, please quit Zotero completely, mac systems need to be quit manually by right clicking on the tray icon, not just closing the main window.

northword avatar Apr 01 '24 07:04 northword

Definitely quit. No presence of it in activity monitor either. Might start from scratch again and see what happens ¯_(ツ)_/¯

carljoseph avatar Apr 01 '24 07:04 carljoseph

try restart pc (An attempt that seems silly but works most of the time.

northword avatar Apr 01 '24 07:04 northword

Unfortunately no change :(

Just reverted back to the start. When I download the plugin template code, update the zotero-cmd.json, do the whole npm install, npm run build, npm start and I get the same error in Zotero.

However, if I install the .xpi plugin itself after building it, it works fine ¯_(ツ)_/¯

carljoseph avatar Apr 01 '24 07:04 carljoseph

Please check the plugin directory if it's an xpi or the text file linking to the dev build. I guess if you manually installed a plugin from xpi, the npm run start will not be able to overwrite it to the dev build.

windingwind avatar Apr 01 '24 13:04 windingwind

Thanks for the idea. I set up a completely new profile in Zotero and still get the same problem :(

carljoseph avatar Apr 01 '24 21:04 carljoseph

Enable the plugin if it was disabled, then quit Zotero and run npm start again.

syt2 avatar Apr 02 '24 01:04 syt2

Enable the plugin if it was disabled, then quit Zotero and run npm start again.

Now why did that do the trick?! Thank you!!

So here's the full process to get it to work ...

  1. Create a new Zotero profile zotero -p
  2. Manually create the extensions folder in your profile directory '/Users/user.name/Library/Application Support/Zotero/Profiles/1e736rli.dev2/extensions/(for some reasonnpm start` fails if it doesn't already exist)
  3. Update zotero-cmd.json
  4. npm start
  5. Enable the plugin
  6. Shut down Zotero
  7. npm start again

Thank you everyone for your patience and help with this.

carljoseph avatar Apr 02 '24 01:04 carljoseph

Should be fixed in the latest plugin template.

windingwind avatar May 15 '24 07:05 windingwind