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

"module wxt not found" in GitHub Actions during yarn install #1058

Open
5 tasks done
mklueh opened this issue Oct 9, 2024 · 4 comments
Open
5 tasks done

"module wxt not found" in GitHub Actions during yarn install #1058

mklueh opened this issue Oct 9, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@mklueh
Copy link

mklueh commented Oct 9, 2024

Describe the bug

So my overall setup is Nx, Yarn Berry 4.5.0 and GitHub Actions for CI.

I've installed wxt and @wxt-dev/vue locally, as dev dependencies and on my PC everything works as expected.

In the CI however the yarn install command fails with

➤ YN0007: │ sharp@npm:0.33.5 must be built because it never has been before or the last one failed
  ➤ YN0007: │ @swc/core@npm:1.7.26 [da0cf] must be built because it never has been before or the last one failed
  ➤ YN0007: │ sharp@npm:0.32.6 must be built because it never has been before or the last one failed
  ➤ YN0007: │ better-sqlite3@npm:11.3.0 must be built because it never has been before or the last one failed
  ➤ YN0000: │ @my-workspace/extension@workspace:apps/browser-extension STDERR command not found: wxt
  ➤ YN0009: │ @my-workspace/extension@workspace:apps/browser-extension couldn't be built successfully (exit code 127, logs can be found here: /tmp/xfs-74[90](https://github.com/my-organization/my-workspace/actions/runs/11242673931/job/31277891170#step:13:94)8f99/build.log)

My first idea was to expose the contents of node_modules/.bin as ENV variables with

      - name: Set ENV variables to node binaries
        run: export PATH="$(yarn bin):$PATH"

But this doesn't make sense, as it fails during the install command and this would only run afterwards.
I guess it's mainly the prepare command that is called during install and immediately fails.

I've tried to install wxt globally as a backup solution, leading to another error

  [fail] Command failed after 13.4 s
  Error:  Cannot find package '@wxt-dev/module-vue' imported from /opt/hostedtoolcache/node/22.9.0/x64/lib/node_modules/wxt/dist/core/resolve-config.mjs
    at packageResolve (node:internal/modules/esm/resolve:839:9)
    at moduleResolve (node:internal/modules/esm/resolve:908:18)
    at defaultResolve (node:internal/modules/esm/resolve:1038:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
    at onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:482:36)
    at TracingChannel.tracePromise (node:diagnostics_channel:337:14)
    at ModuleLoader.import (node:internal/modules/esm/loader:481:21)
    at defaultImportModuleDynamicallyForModule (node:internal/modules/esm/utils:214:31)
    at importModuleDynamicallyCallback (node:internal/modules/esm/utils:253:12)
    at /opt/hostedtoolcache/node/22.9.0/x64/lib/node_modules/wxt/dist/core/resolve-config.mjs:324:19
    at Array.map (<anonymous>)
    at resolveWxtUserModules (/opt/hostedtoolcache/node/22.9.0/x64/lib/node_modules/wxt/dist/core/resolve-config.mjs:323:13)
    at resolveConfig (/opt/hostedtoolcache/node/22.9.0/x64/lib/node_modules/wxt/dist/core/resolve-config.mjs:88:29)
    at async registerWxt (/opt/hostedtoolcache/node/22.9.0/x64/lib/node_modules/wxt/dist/core/wxt.mjs:10:18)
    at async prepare (/opt/hostedtoolcache/node/22.9.0/x64/lib/node_modules/wxt/dist/core/prepare.mjs:5:3)
    at async /opt/hostedtoolcache/node/22.9.0/x64/lib/node_modules/wxt/dist/cli/commands.mjs:76:5
    at async CAC.<anonymous> (/opt/hostedtoolcache/node/22.9.0/x64/lib/node_modules/wxt/dist/cli/cli-utils.mjs:16:22)
    at async /opt/hostedtoolcache/node/22.9.0/x64/lib/node_modules/wxt/dist/cli/index.mjs:11:1

Not sure if this is related to Yarn, but I'd appreciate any help.

Reproduction

Not easily reproducible

Steps to reproduce

No response

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
    Memory: 1.73 GB / 15.77 GB
  Binaries:
    Node: 22.9.0 - ~\.nvm\versions\node\v22.9.0\bin\node.EXE
    Yarn: 4.5.0 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.19.4 - ~\Workspace\my-workspace\node_modules\.bin\npm.CMD
  npmPackages:
    vite: 5.4.8 => 5.4.8
    wxt: ^0.19.11 => 0.19.11

Used Package Manager

yarn

Validations

@mklueh mklueh added the pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug label Oct 9, 2024
@aklinker1
Copy link
Collaborator

Hmm, yeah, looks like yarn 4.5 just doesn't work with the latest version.

repro.zip

yarn

With @wxt-dev/module-vue:

$ cat /private/var/folders/g2/ztr_kd996gv4vv11lxwggz8c0000gn/T/xfs-6cd13a85/build.log
# This file contains the result of Yarn building a package (wxt-starter@workspace:.)
# Script name: postinstall


WXT 0.19.11
ℹ Generating types...
file:///Users/aklinker1/.yarn/berry/cache/mlly-npm-1.7.2-dbf2e47745-10c0.zip/node_modules/mlly/dist/index.mjs:2102
    const error = new Error(
                  ^

Error: Cannot find module wxt/client imported from file:///Users/aklinker1/Development/local/wxt-issue-1058, file:///Users/aklinker1/Development/local/, file:///Users/aklinker1/Development/local/wxt-issue-1058/_index.js, file:///Users/aklinker1/Development/local/node_modules
    at _resolve (file:///Users/aklinker1/.yarn/berry/cache/mlly-npm-1.7.2-dbf2e47745-10c0.zip/node_modules/mlly/dist/index.mjs:2102:19)
    at resolveSync (file:///Users/aklinker1/.yarn/berry/cache/mlly-npm-1.7.2-dbf2e47745-10c0.zip/node_modules/mlly/dist/index.mjs:2111:10)
    at resolvePathSync (file:///Users/aklinker1/.yarn/berry/cache/mlly-npm-1.7.2-dbf2e47745-10c0.zip/node_modules/mlly/dist/index.mjs:2121:24)
    at resolvePath (file:///Users/aklinker1/.yarn/berry/cache/mlly-npm-1.7.2-dbf2e47745-10c0.zip/node_modules/mlly/dist/index.mjs:2125:28)
    at resolvePackageJSON (file:///Users/aklinker1/.yarn/berry/cache/pkg-types-npm-1.2.1-fd28245c53-10c0.zip/node_modules/pkg-types/dist/index.mjs:103:52)
    at extractExports (file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:289:33)
    at resolvePackagePreset (file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:271:25)
    at resolvePreset (file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:1196:18)
    at file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:1220:18
    at Array.map (<anonymous>)
    at resolveBuiltinPresets (file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:1216:46)
    at createInternalContext (file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:1340:20)
    at createUnimport (file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:1226:15)
    at file:///Users/aklinker1/Development/local/wxt-issue-1058/.yarn/__virtual__/wxt-virtual-1da7d21582/4/.yarn/berry/cache/wxt-npm-0.19.11-89f86a5551-10c0.zip/node_modules/wxt/dist/builtin-modules/unimport.mjs:21:20
    at callEachWith (file:///Users/aklinker1/.yarn/berry/cache/hookable-npm-5.5.3-82b0342097-10c0.zip/node_modules/hookable/dist/index.mjs:68:5)
    at file:///Users/aklinker1/.yarn/berry/cache/hookable-npm-5.5.3-82b0342097-10c0.zip/node_modules/hookable/dist/index.mjs:205:11
    at <anonymous>
    at async registerWxt (file:///Users/aklinker1/Development/local/wxt-issue-1058/.yarn/__virtual__/wxt-virtual-1da7d21582/4/.yarn/berry/cache/wxt-npm-0.19.11-89f86a5551-10c0.zip/node_modules/wxt/dist/core/wxt.mjs:39:3)
    at async prepare (file:///Users/aklinker1/Development/local/wxt-issue-1058/.yarn/__virtual__/wxt-virtual-1da7d21582/4/.yarn/berry/cache/wxt-npm-0.19.11-89f86a5551-10c0.zip/node_modules/wxt/dist/core/prepare.mjs:5:3)
    at async file:///Users/aklinker1/Development/local/wxt-issue-1058/.yarn/__virtual__/wxt-virtual-1da7d21582/4/.yarn/berry/cache/wxt-npm-0.19.11-89f86a5551-10c0.zip/node_modules/wxt/dist/cli/commands.mjs:76:5
    at async CAC.<anonymous> (file:///Users/aklinker1/Development/local/wxt-issue-1058/.yarn/__virtual__/wxt-virtual-1da7d21582/4/.yarn/berry/cache/wxt-npm-0.19.11-89f86a5551-10c0.zip/node_modules/wxt/dist/cli/cli-utils.mjs:16:22)
    at async file:///Users/aklinker1/Development/local/wxt-issue-1058/.yarn/__virtual__/wxt-virtual-1da7d21582/4/.yarn/berry/cache/wxt-npm-0.19.11-89f86a5551-10c0.zip/node_modules/wxt/dist/cli/index.mjs:11:1 {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.20.3

Without it:

$ cat /private/var/folders/g2/ztr_kd996gv4vv11lxwggz8c0000gn/T/xfs-87e7677c/build.log
# This file contains the result of Yarn building a package (wxt-starter@workspace:.)
# Script name: postinstall


WXT 0.19.11
ℹ Generating types...
file:///Users/aklinker1/.yarn/berry/cache/mlly-npm-1.7.2-dbf2e47745-10c0.zip/node_modules/mlly/dist/index.mjs:2102
    const error = new Error(
                  ^

Error: Cannot find module wxt/client imported from file:///Users/aklinker1/Development/local/wxt-issue-1058, file:///Users/aklinker1/Development/local/, file:///Users/aklinker1/Development/local/wxt-issue-1058/_index.js, file:///Users/aklinker1/Development/local/node_modules
    at _resolve (file:///Users/aklinker1/.yarn/berry/cache/mlly-npm-1.7.2-dbf2e47745-10c0.zip/node_modules/mlly/dist/index.mjs:2102:19)
    at resolveSync (file:///Users/aklinker1/.yarn/berry/cache/mlly-npm-1.7.2-dbf2e47745-10c0.zip/node_modules/mlly/dist/index.mjs:2111:10)
    at resolvePathSync (file:///Users/aklinker1/.yarn/berry/cache/mlly-npm-1.7.2-dbf2e47745-10c0.zip/node_modules/mlly/dist/index.mjs:2121:24)
    at resolvePath (file:///Users/aklinker1/.yarn/berry/cache/mlly-npm-1.7.2-dbf2e47745-10c0.zip/node_modules/mlly/dist/index.mjs:2125:28)
    at resolvePackageJSON (file:///Users/aklinker1/.yarn/berry/cache/pkg-types-npm-1.2.1-fd28245c53-10c0.zip/node_modules/pkg-types/dist/index.mjs:103:52)
    at extractExports (file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:289:33)
    at resolvePackagePreset (file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:271:25)
    at resolvePreset (file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:1196:18)
    at file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:1220:18
    at Array.map (<anonymous>)
    at resolveBuiltinPresets (file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:1216:46)
    at createInternalContext (file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:1340:20)
    at createUnimport (file:///Users/aklinker1/.yarn/berry/cache/unimport-npm-3.13.1-0226725ef1-10c0.zip/node_modules/unimport/dist/shared/unimport.1c7b6182.mjs:1226:15)
    at file:///Users/aklinker1/Development/local/wxt-issue-1058/.yarn/__virtual__/wxt-virtual-1da7d21582/4/.yarn/berry/cache/wxt-npm-0.19.11-89f86a5551-10c0.zip/node_modules/wxt/dist/builtin-modules/unimport.mjs:21:20
    at callEachWith (file:///Users/aklinker1/.yarn/berry/cache/hookable-npm-5.5.3-82b0342097-10c0.zip/node_modules/hookable/dist/index.mjs:68:5)
    at file:///Users/aklinker1/.yarn/berry/cache/hookable-npm-5.5.3-82b0342097-10c0.zip/node_modules/hookable/dist/index.mjs:205:11
    at <anonymous>
    at async registerWxt (file:///Users/aklinker1/Development/local/wxt-issue-1058/.yarn/__virtual__/wxt-virtual-1da7d21582/4/.yarn/berry/cache/wxt-npm-0.19.11-89f86a5551-10c0.zip/node_modules/wxt/dist/core/wxt.mjs:39:3)
    at async prepare (file:///Users/aklinker1/Development/local/wxt-issue-1058/.yarn/__virtual__/wxt-virtual-1da7d21582/4/.yarn/berry/cache/wxt-npm-0.19.11-89f86a5551-10c0.zip/node_modules/wxt/dist/core/prepare.mjs:5:3)
    at async file:///Users/aklinker1/Development/local/wxt-issue-1058/.yarn/__virtual__/wxt-virtual-1da7d21582/4/.yarn/berry/cache/wxt-npm-0.19.11-89f86a5551-10c0.zip/node_modules/wxt/dist/cli/commands.mjs:76:5
    at async CAC.<anonymous> (file:///Users/aklinker1/Development/local/wxt-issue-1058/.yarn/__virtual__/wxt-virtual-1da7d21582/4/.yarn/berry/cache/wxt-npm-0.19.11-89f86a5551-10c0.zip/node_modules/wxt/dist/cli/cli-utils.mjs:16:22)
    at async file:///Users/aklinker1/Development/local/wxt-issue-1058/.yarn/__virtual__/wxt-virtual-1da7d21582/4/.yarn/berry/cache/wxt-npm-0.19.11-89f86a5551-10c0.zip/node_modules/wxt/dist/cli/index.mjs:11:1 {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.20.3

Didn't get your exact error, but things obviously don't work.

I don't know enough about yarn berry, but you could try using it in pnpm mode as a workaround?

@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 Oct 9, 2024
@mklueh
Copy link
Author

mklueh commented Oct 9, 2024

Hello,

I've tried pnpm as well as pnp modes.

pnpm fails with an obsucre linking issue regarding the shiki package while the pnp issue now shifts the problem to the nuxt package

nuxt/cli#217 (comment)

@mklueh
Copy link
Author

mklueh commented Oct 20, 2024

So I've tried migrating to pnpm, but this introduced some other problems.

Besides that I've tried to get the root node_modules/. bin into the PATH, but there seems to be no clear approach either, as it needs to work on my windows machine and in CI as well.

I've added a .bashrc file into my project, but I believe this has no effect on windows, depending on the terminal. Might work in Git bash, but Nx/Node launches CMD and there the problem occurs.

So I've added the absolute path to my projects node_modules/.bin to my Windows Environment Variables. Feels totally wrong but at least it works now, and luckily I'm not having to do that for several projects but just this one monorepo.

With Nuxt I seem to indeed have the same issue, but I'm installing it globally in CI as I to not want to prefix every single script call in every package.json

Now I've given up and just use npx in that case and it works :)

@Foddie2
Copy link

Foddie2 commented Oct 21, 2024

Unable to install packages

error Can't add "nuxt-app": invalid package version "".

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

No branches or pull requests

3 participants