laurent22 / joplin

Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
45.19k stars 4.92k forks source link

Plugins: Cannot execute a command without a runtime #5551

Closed ylc395 closed 2 years ago

ylc395 commented 2 years ago

Environment

Joplin version: Joplin 2.4.9 (prod, darwin) Platform: macOS OS specifics: 10.15.7

Steps to reproduce

Here is a simple plugin(home note 1.0.2) https://github.com/lkiThakur/homenote/blob/master/src/index.ts

await joplin.commands.execute("openNote", homeNoteId); in onStart raise an error below:

Logfile

joplin.plugins: Uncaught exception in plugin "com.lki.homenote": Error: Cannot execute a command without a runtime: openNote
    at CommandService.<anonymous> (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/services/CommandService.js:144)
    at Generator.next (<anonymous>)
    at /Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/services/CommandService.js:8
    at new Promise (<anonymous>)
    at __awaiter (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/services/CommandService.js:4)
    at CommandService.execute (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/services/CommandService.js:136)
    at JoplinCommands.<anonymous> (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/services/plugins/api/JoplinCommands.js:84)
    at Generator.next (<anonymous>)
    at /Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/services/plugins/api/JoplinCommands.js:8
    at new Promise (<anonymous>)
laurent22 commented 2 years ago

Does it work if you set a timeout before calling the command?

setTimeout(() => {
    await joplin.commands.execute("openNote", homeNoteId);
}, 2000);
github-actions[bot] commented 2 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

github-actions[bot] commented 2 years ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, feel free to create a new issue with up-to-date information.