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

Hardcoded wasm-opt path invalid when installing jco as a dev dep #378

Open
morigs opened this issue Feb 15, 2024 · 1 comment
Open

Hardcoded wasm-opt path invalid when installing jco as a dev dep #378

morigs opened this issue Feb 15, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@morigs
Copy link
Contributor

morigs commented Feb 15, 2024

I've installed jco as a dev time dependency instead of global bin (npm i -D @bytecodealliance/jco).

The opt command looks for wasm-opt at ../../node_modules/binaryen/bin/wasm-opt.

However, npm installed it at the root of three to avoid duplicates (node_modules/binaryen, not node_modules/@bytecodealliance/jco/node_modules/binaryen).

Perhaps, using require.resolve('binaryen/bin/wasm-opt') will resolve the issue.

Full error text:

(jco opt) Error: node:internal/modules/cjs/loader:1152
  throw err;
  ^

Error: Cannot find module '***/example/node_modules/@bytecodealliance/jco/node_modules/binaryen/bin/wasm-opt'
    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.1
@guybedford
Copy link
Collaborator

Agreed we should use a node_modules backtracking technique here in whatever form.

@guybedford guybedford added the bug Something isn't working label Feb 16, 2024
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

2 participants