Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: import declarations may only appear at top level of a module #416

Closed
ahadfarajpour opened this issue Nov 7, 2023 · 13 comments

Comments

@ahadfarajpour
Copy link

software information
ubuntu 23.10
64-bit
kernel linux 6.5.0-10-generic
GNOME Shell 45.0
Error
SyntaxError: import declarations may only appear at top level of a module
Stack trace:
@file:///home/lost/.local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com/prefs.js:5:19
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34

@hasan-sh
Copy link

hasan-sh commented Nov 7, 2023

cannot install it either

@Tudmotu
Copy link
Owner

Tudmotu commented Nov 7, 2023

What version of the extension do you have?

@ahadfarajpour
Copy link
Author

ahadfarajpour commented Nov 7, 2023

What version of the extension do you have?

How can I find the extension version?

@Tudmotu
Copy link
Owner

Tudmotu commented Nov 8, 2023

@ahadfarajpour did you install the extension through e.g.o?
Check if you have an update available here:
https://extensions.gnome.org/local/

@ahadfarajpour
Copy link
Author

@ahadfarajpour did you install the extension through e.g.o? Check if you have an update available here: https://extensions.gnome.org/local/

Yes, it is installed and it is the latest version
I got this problem since I upgraded Ubuntu to 23.10
Before the upgrade was working perfectly

@Tudmotu Tudmotu changed the title Error SyntaxError: import declarations may only appear at top level of a module Nov 22, 2023
@cesarFrias
Copy link

cesarFrias commented Nov 28, 2023

I had the same issue when upgrading to fedora 39.
Gnome-shell version 45.1
Extension installed from https://extensions.gnome.org/local/

@Tudmotu
Copy link
Owner

Tudmotu commented Nov 28, 2023

@cesarFrias thank you for reporting.
I am still looking into this. I'm not even sure how to reproduce this error.

@cesarFrias
Copy link

I did nothing and it came back to work! Like magic. Sorry for the noise

@Tudmotu
Copy link
Owner

Tudmotu commented Nov 28, 2023

Anyone who is experiencing this issue, could you please share the output of the following commands:

$ gjs --version
$ cat ~/.local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com/metadata.json

And also please try restarting your computer (or at least logout of GNOME) and see if the issue persists?
Thanks!

@CrossedCarpet
Copy link

CrossedCarpet commented Dec 2, 2023

$ gjs --version                                                                                                       
gjs 1.78.0
$ cat ~/.local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com/metadata.json                                  
{
  "_generated": "Generated by SweetTooth, do not edit",
  "description": "Clipboard Manager extension for Gnome-Shell - Adds a clipboard indicator to the top panel, and caches clipboard history.",
  "name": "Clipboard Indicator",
  "shell-version": [
    "42",
    "43",
    "44"
  ],
  "url": "https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator",
  "uuid": "clipboard-indicator@tudmotu.com",
  "version": 47
}

The extension used to work and this happened after defining a key in one of the settings. Not sure of causality though.

@CrossedCarpet
Copy link

tried to edit the code, logged out and it's working. Don't think it's related to me editing it though...

@Tudmotu
Copy link
Owner

Tudmotu commented Dec 3, 2023

Thanks @CrossedCarpet. I think the re-login is what solves it. From the metadata.json file you shared it seems the extension was an old version. It only got actually updated once you logged-in again.

I am closing this issue for now. If anyone still has issues after a restart / re-login, feel free to open.

@Tudmotu Tudmotu closed this as completed Dec 3, 2023
@ahadfarajpour
Copy link
Author

My trowel was also fixed by itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants