Reputation: 21
I am trying my hand at building a simple extension for Firefox, but got the following error when running web-ext run
:
Error: not found: firefox
at F (/usr/local/lib/node_modules/web-ext/node_modules/fx-runner/node_modules/which/which.js:63:19)
at E (/usr/local/lib/node_modules/web-ext/node_modules/fx-runner/node_modules/which/which.js:72:29)
at /usr/local/lib/node_modules/web-ext/node_modules/fx-runner/node_modules/which/which.js:81:16
at /usr/local/lib/node_modules/web-ext/node_modules/fx-runner/node_modules/isexe/index.js:44:5
at /usr/local/lib/node_modules/web-ext/node_modules/fx-runner/node_modules/isexe/access.js:8:5
at FSReqCallback.oncomplete (node:fs:198:23)
NOTE: I am running this in Ubuntu Linux subsystem for Windows 10. Not sure if that affects anything, but that's why the directory structures are a bit weird. I've also tried running the same commands on Firefox Developer Edition with the same results.
I tried the following commands:
web-ext run -v
web-ext run -v --firefox="C:\Program Files\Mozilla Firefox\firefox.exe"
These give the following response:
[/usr/local/lib/node_modules/web-ext/lib/program.js][info] Version: 7.6.2
[/usr/local/lib/node_modules/web-ext/lib/program.js][debug] Discovering config files. Set --no-config-discovery to disable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "/home/knuffle98/.web-ext-config.js" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "/mnt/c/Users/Knuffle98/Code/Repos/Applicator/package.json" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "/mnt/c/Users/Knuffle98/Code/Repos/Applicator/web-ext-config.js" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/cmd/run.js][info] Running web extension from /mnt/c/Users/Knuffle98/Code/Repos/Applicator
[/usr/local/lib/node_modules/web-ext/lib/util/manifest.js][debug] Validating manifest at /mnt/c/Users/Knuffle98/Code/Repos/Applicator/manifest.json
[/usr/local/lib/node_modules/web-ext/lib/extension-runners/firefox-desktop.js][debug] Creating new Firefox profile
[/usr/local/lib/node_modules/web-ext/lib/firefox/index.js][debug] Running Firefox with profile at /tmp/firefox-profilesTWUXQ/
[/usr/local/lib/node_modules/web-ext/lib/program.js][error]
Error: not found: C:\Program Files\Mozilla Firefox\firefox.exe
at F (/usr/local/lib/node_modules/web-ext/node_modules/fx-runner/node_modules/which/which.js:63:19)
at E (/usr/local/lib/node_modules/web-ext/node_modules/fx-runner/node_modules/which/which.js:72:29)
at /usr/local/lib/node_modules/web-ext/node_modules/fx-runner/node_modules/which/which.js:81:16
at /usr/local/lib/node_modules/web-ext/node_modules/fx-runner/node_modules/isexe/index.js:44:5
at /usr/local/lib/node_modules/web-ext/node_modules/fx-runner/node_modules/isexe/access.js:8:5
at FSReqCallback.oncomplete (node:fs:198:23)
What do you guys think is the problem?
For reference, it's a couple steps before this problem: Failed to sign Firefox WebExtensions with web-ext
Upvotes: 1
Views: 814
Reputation: 51
I encountered a similar issue with web-ext
on WSL for Firefox. Interestingly, specifying the target as chromium works for me: web-ext run --target=chromium
. It's unclear why for Chrome it doesn't throw an error as both are installed as windows executables.
But assuming you are using WSL for development only, consider developing and/or building your extension on WSL and then for testing, run web-ext
from your source folder on Windows using the command prompt. This is a just a workaround, but it worked for me and I was able launch Firefox with the extension loaded.
Alternatively, you can try to install Firefox on WSL. There is an existing AskUbuntu question here that you can refer. The following is borrowed from the accepted answer.
Refer to this url for installation guide: https://ubuntuhandbook.org/index.php/2022/04/install-firefox-deb-ubuntu-22-04/. First two steps are optional for package removal:
sudo snap remove firefox
sudo apt remove firefox
sudo add-apt-repository ppa:mozillateam/ppa
# Create a new file, it should be empty as it opens:
sudo gedit /etc/apt/preferences.d/mozillateamppa
# Insert these lines, then save and exit
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 501
# after saving, do
sudo apt update
sudo apt install firefox # or firefox-esr
Upvotes: 0