jco
jco copied to clipboard
Hardcoded wasm-opt path invalid when installing jco as a dev dep
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
Agreed we should use a node_modules backtracking technique here in whatever form.