-
Notifications
You must be signed in to change notification settings - Fork 372
Closed
Description
Is this a feature request or a bug?
Bug.
What is the current behavior?
When running webExt.cmd.run in a NodeJS script, Firefox fails to open, and web-ext fails with the following error:
file:///path-to-extension/node_modules/web-ext/lib/firefox/remote.js:92
throw new WebExtError(`installTemporaryAddon: Error: ${message}`);
^
WebExtError: installTemporaryAddon: Error: Error: Could not install add-on at '.': [Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsIFile.initWithPath]" nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)" location: "JS frame :: resource://devtools/server/actors/addon/addons.js :: installTemporaryAddon :: line 31" data: no]
at RemoteFirefox.installTemporaryAddon (file:///path-to-extension/node_modules/web-ext/lib/firefox/remote.js:92:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async FirefoxDesktopExtensionRunner.startFirefoxInstance (file:///path-to-extension/node_modules/web-ext/lib/extension-runners/firefox-desktop.js:216:27)
at async FirefoxDesktopExtensionRunner.run (file:///path-to-extension/node_modules/web-ext/lib/extension-runners/firefox-desktop.js:49:5)
at async Promise.all (index 0)
at async MultiExtensionRunner.run (file:///path-to-extension/node_modules/web-ext/lib/extension-runners/index.js:66:5)
at async run (file:///path-to-extension/node_modules/web-ext/lib/cmd/run.js:177:3)
Node.js v21.4.0Everything works as expected when passing target: chromium as an option, and Chromium launches with the extension loaded. The issue only occurs in Firefox. There are also no issues when web-ext is run via the command line, and Firefox launches as expected:
npx web-ext run --source-dir=.The issue only occurs when using web-ext in a NodeJS script.
Steps to reproduce
- This bug appears to be independent of the extension used. One should therefore be able to reproduce this bug with any minimal extension. To create a MRE, I used one of the example extensionslons:
git clone git clone https://github.com/mdn/webextensions-examples.git && cd webextensions-examples/beastify- Create the file
package.jsonwith the following contents:
{
"type": "module",
"devDependencies": {
"web-ext": "^7.9.0"
}
}- Run
npm install. - Create a file
run.jswith the following contents:
import webExt from 'web-ext';
webExt.cmd.run({sourceDir: '.'});- Run
node run.jsand observe the above error. - Execute
npx web-ext run --source-dir=.and observe that Firefox launches without issue. - Modify the file
run.jsto have the following contents:
import webExt from 'web-ext';
webExt.cmd.run({sourceDir: '.', target: 'chromium'});- Run
node run.jsagain and observe that Chromium launches without issue.
What is the expected or desired behavior?
Firefox should launch as it does when running npx web-ext from the command line.
Version information (for bug reports)
- Firefox version: Mozilla Firefox 120.0.1
- Your OS and version: Arch Linux
- Output of commands
node --version && npm --version && npx web-ext --version:
v21.4.0
10.2.5
7.9.0Reactions are currently unavailable