arelange / gnome-shell-extension-hibernate-status

Gnome Shell extension that adds a hibernate/hybrid suspend button in Status menu.
GNU General Public License v2.0
151 stars 54 forks source link

ImportError: No JS module "prefs" found in search path #32

Closed ccrisan closed 4 years ago

ccrisan commented 5 years ago

Looking glass reports the following error:

ImportError: No JS module "prefs" found in search path

I'm on Arch Linux with Gnome Shell 3.32.2 and the extension version is 030ccdf. The hibernate button doesn't show up in the status menu.

Any help would be appreciated. Please let me know if further details are needed.

p91paul commented 5 years ago

Could you try the suggestion reported here?

Doesn't seem related to the error you got from lg, but symptoms are the same.

ccrisan commented 5 years ago

@p91paul the issue you mentioned (#30) doesn't seem to have anything to do with my problem. I don't use polkit and my hibernation works like a charm in every other way except for this extension.

The extension doesn't even load at all and yields the import error at the very beginning.

p91paul commented 5 years ago

well, their hibernation worked like a charm as well, except the extension didn't load and the hibernate button didn't show up, so I'd say it's pretty similar.

I don't know about polkit however, I always thought it was a gnome dependency, didn't know it could work without it. Actually, isn't polkit supposed to handle actions, like hibernation, that are normally only allowed for the root user? back a few years ago without polkit you couldn't even shutdown the system, don't know if systemd changed this.

Could you collect journalctl output while you uninstall and reinstall the extension?

ccrisan commented 5 years ago

@p91paul I did the polkit workaround mentioned in #30 but with no positive effect.

When installing the extension (via extensions.gnome.org), journalctl -f only said:

Jul 13 19:51:14 asus430ua gnome-shell[1442]: Some code accessed the property 'Prefs' on the module 'prefs'. That property was defined with 'let' or 'const' inside the module. This was previously supported, but is not correct according to the ES6 standard. Any symbols to be exported from a module must be defined with 'var'. The property access will work as previously for the time being, but please fix your code anyway.
zsolt-donca commented 4 years ago

I have the same issue as @ccrisan. I am on Arch, with gnome 3.34.1

The relevant error log from the journal:

JS ERROR: Extension hibernate-status@dromi: ImportError: No JS module 'prefs' found in search path
@/usr/share/gnome-shell/extensions/hibernate-status@dromi/extension.js:13:7
_callExtensionInit@resource:///org/gnome/shell/ui/extensionSystem.js:326:13
loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:260:22
_loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:473:13
collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:17
_loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:452:9
_enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:482:13
_sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:513:13
init@resource:///org/gnome/shell/ui/extensionSystem.js:31:9
_initializeUI@resource:///org/gnome/shell/ui/main.js:242:5
start@resource:///org/gnome/shell/ui/main.js:138:5
@<main>:1:31

Can this be a dependency issue? Any help is appreciated.

zsolt-donca commented 4 years ago

I think I've found out what was wrong: the AUR build script was outdated and did not install the file prefs.js and the folder schemas into the resulting package. The schemas folder also needed compiling.

My fix was to modify the PKGBUILD file as below:

diff --git a/PKGBUILD b/PKGBUILD
index 8e15d7d..a5736bd 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
 #Packaged by ryanvade 

 pkgname=gnome-shell-extension-hibernate-status-git
-pkgver=r11.e358c28
+pkgver=r46.6afc7c6
 pkgrel=1
 pkgdesc="Gnome Shell extension that adds a hibernate/hybrid suspend button in Status menu."
 arch=('any')
@@ -29,4 +29,9 @@ package() {
     "${pkgdir}/usr/share/gnome-shell/extensions/${_uuid}/extension.js"
   install -m644 "confirmDialog.js" \
     "${pkgdir}/usr/share/gnome-shell/extensions/${_uuid}/confirmDialog.js"
+  install -m644 "prefs.js" \
+    "${pkgdir}/usr/share/gnome-shell/extensions/${_uuid}/prefs.js"
+  glib-compile-schemas "schemas"
+  install -Dm644 "schemas/gschemas.compiled" \
+    "${pkgdir}/usr/share/gnome-shell/extensions/${_uuid}/schemas/gschemas.compiled"
 }
p91paul commented 4 years ago

Ok so the bug is downstream in AUR. Thanks for debugging this, I see you already commented on AUR as well.