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

web-ext fails to start #256174

Closed
wingdeans opened this issue Sep 19, 2023 · 3 comments
Closed

web-ext fails to start #256174

wingdeans opened this issue Sep 19, 2023 · 3 comments
Labels
0.kind: bug Something is broken

Comments

@wingdeans
Copy link

Describe the bug

Running web-ext results in an error due to not being able to find git-rev-sync. This is due to a branch that only runs when web-ext is built with NODE_ENV=development. This bug was introduced in #250477 with the switch away from the npm registry. A simple fix exports NODE_ENV=production as part of the preBuild hook.

Here is the relevant line from the program.js in the nix store:

const defaultGlobalEnv = "development" || 'development';

Here is the same line from the npm registry (used by the old nix package):

const defaultGlobalEnv = "production" || 'development';

Steps To Reproduce

Reproduce by running any web-ext command:

$ web-ext --help
node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'git-rev-sync' imported from /nix/store/pzqvm774id8cj7nslvpbd4lwywapmpbn-web-ext-7.6.2/lib/node_modules/web-ext/lib/program.js
    at new NodeError (node:internal/errors:405:5)
    at packageResolve (node:internal/modules/esm/resolve:887:9)
    at moduleResolve (node:internal/modules/esm/resolve:936:20)
    at defaultResolve (node:internal/modules/esm/resolve:1129:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ESMLoader.import (node:internal/modules/esm/loader:524:22)
    at importModuleDynamically (node:internal/modules/esm/translators:110:35)
    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Expected behavior

Output of fixed web-ext:

$ web-ext --help
Usage: web-ext.js [options] command
@wingdeans wingdeans added the 0.kind: bug Something is broken label Sep 19, 2023
@theowenyoung
Copy link

Same here

@kirillrdy
Copy link
Member

@wingdeans I think this has been resolved

using 022cbac

[kirillvr@osaka:~/nixpkgs]$ nix-build -A web-ext
/nix/store/v8brnsmhzcgiwxslzhmrkvyk9r42c6gm-web-ext-7.9.0

[kirillvr@osaka:~/nixpkgs]$ ./result/bin/web-ext --help
Usage: web-ext.js [options] command

Option values can also be set by declaring an environment variable prefixed
with $WEB_EXT_. For example: $WEB_EXT_SOURCE_DIR=/path is the same as
--source-dir=/path.

@wingdeans
Copy link
Author

Confirmed fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants