Javascript error on launching discord-canary

The following error occurs as soon a discord starts it’s updater.

A fatal Javascript error occurred
Error: Cannot find module 'discord_desktop_core'
Require stack:
~ /opt/discord-canary/resources/app-asar/app_bootstrap/requireNative.js
~ /opt/discord-canary/resources/app-asar/app_bootstrap/indes.js
  at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
  at Function.n._resolveFilename (node:internal/modules/js2c/browser_init:249:1105)
  at Module._load (node:internal/modules/cjs/loader:785:27)
  at Function.c._laod (node:internal/modules/js2c/asar_bundle:5:13343)
  at Module.require (node:internal/modules/cjs/loader:1012:19)
  at require (node:internal/modules/cjs/helpers:102:18)
  at EventEmitter <anaonymous> (/opt/discord-canary/resources/app.assar/app_bootstrap/bootstrap.js:168:20)
  at Object.onceWrapper (node:events:509:28)
  at EventEmitter.emit(node:events:390:28)
  at EventEmitter.emit(node:domain:475:12)

Things I’ve tried to fix it.
Uninstall and re-install from GUI pacman with and without reboots in between.
Uninstall from command line
sudo pacman -Rns discord-canary

dump cache of pacman
sudo pacman -Scc
(answering y to both queries)

Deleting /home/(user)/.config/Discord-Canary/ directory (including emptying trash and reboots after uninstalling)

Despite trying to dump the pacman cache of downloaded packages, it doesn’t do a download on re-install, while this may not be my problem it’s still disappointing that I clearly don’t understand how to completely purge the cache for pacman or completely uninstall the software. When the software is installed /opt/discord-canary/resources/app.asar is present and has rw-r-r privileges

I have also tried installing powercord (but it installs discord-canary in the background and you can see where this is going, it throws the same error).
Installing any other flavour of discord wants to download and install extra packages, often quite big ones like gnome (I’m running xfce) or python 2.7, neither of which I want.

any help would be appreciated.

discord-canary is an AUR package, and pacman does not install packages from the AUR. You need pamac for that, or yay. :arrow_down:

pamac build discord-canary

Don’t use sudo with that. pamac (and yay) will ask for a password when needed.

(It’s looking in /opt instead of your home dir…)

Plus what @Aragorn pointed out…

1 Like

@Aragorn thank you for the pointer to pamac
@TriMoon ~/opt/discord-canary was correctly being removed by the uninstall. This wasn’t my problem.

It turned out, based on what worked (deleted the discord-canary folder in /var/tmp/pamac-build-[user]/ and the discord-canary-0.0.146-2 folder in /var/tmp/pamac/aur-[user]/) I had a corrupted install package downloaded. Forcing pamac to re-download the package worked as the install worked and setup a working discord canary.

pamac clean
didn’t do any good here either, it didn’t try to delete anything including trying a couple of options (-k 1, -u) not sure why it wouldn’t remove what was on disk in /var/tmp/pamac but brute force and ignorance worked.