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

wtx submit init not finding publish-browser-extension #479

Closed
leos opened this issue Feb 22, 2024 · 6 comments · Fixed by #482
Closed

wtx submit init not finding publish-browser-extension #479

leos opened this issue Feb 22, 2024 · 6 comments · Fixed by #482
Assignees
Labels
bug Something isn't working

Comments

@leos
Copy link
Contributor

leos commented Feb 22, 2024

Describe the bug

I'm trying to invoke wtx submit init but it's not working - it seems to be looking for publish-browser-extension in the wrong place?

I started with the React template if that's useful. I can try to create a repro if this is not something common (my first time with wtx and chrome extensions/typescript/etc.). Let me know if I can provide any other info.

~/repos/DVR2/MyProject ❯❯❯ pnpm wxt submit init
node:internal/modules/cjs/loader:1152
  throw err;
  ^

Error: Cannot find module '/Users/xxx/repos/DVR2/[email protected]/node_modules/publish-browser-extension/bin/publish-extension.cjs'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1149:15)
    at Module._load (node:internal/modules/cjs/loader:990:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v21.6.2

Environment

  System:
    OS: macOS 14.3.1
    CPU: (12) arm64 Apple M2 Pro
    Memory: 267.41 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.6.2 - /opt/homebrew/bin/node
    npm: 10.2.4 - /opt/homebrew/bin/npm
    pnpm: 8.15.3 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 122.0.6261.57
    Safari: 17.3.1
  npmPackages:
    wxt: ^0.16.0 => 0.16.9
@leos leos added the pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug label Feb 22, 2024
@aklinker1
Copy link
Collaborator

Yeah, I can reproduce this, but I can't figure out why it's failing. Something to do with the binary PNPM is creating, it's pointing at the wrong directory to lookup the JS file... My current setup is just to add node_modules/wxt/node_modules/.bin (where publish-extension is located) to the PATH environment variable, but that's causing the messedup path, so I need to think of something else.

Also, this also breaks wxt build --analyze, which is also using a subdependencies binary.

I think I'll lookup the executable path and execute it directly rather than manipulating the PATH environment variable.

@aklinker1 aklinker1 added bug Something isn't working and removed pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug labels Feb 23, 2024
@aklinker1 aklinker1 self-assigned this Feb 23, 2024
@aklinker1
Copy link
Collaborator

Hmm, OK, so same error if I run the binaries directly without modifying the path... I think I'll have to go with the route of asking you to install the package if it can't be found, similar to vitest when you run the coverage command for the first time asking to install the coverage module.

@aklinker1
Copy link
Collaborator

I wonder what broke.... This used to work, but now it doesn't? Maybe PNPM has updated... Hmm. Either way, asking to install will work, and is the most future-proof I think.

@aklinker1
Copy link
Collaborator

aklinker1 commented Feb 23, 2024

Hmm, yeah, still can't find a way to figure this out. For now, a workaround:

pnpm i publish-browser-extension
pnpm publish-extension init

wxt submit is just an alias for publish-extension, so you can run that CLI tool manually.

@aklinker1
Copy link
Collaborator

aklinker1 commented Feb 23, 2024

Fixed in v0.17.2. See #482 for fix details.

@leos
Copy link
Contributor Author

leos commented Feb 23, 2024

Works great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants