dusa icon indicating copy to clipboard operation
dusa copied to clipboard

Build from source issue: `Cannot find module '.../dusa/lib/cli.js'`

Open minsungc opened this issue 11 months ago • 1 comments

On an ARM Mac, I cloned the repo and attempted to run

npx dusa examples/mutual-exclusion.dusa

as per the README and ran into this error message:

node:internal/modules/esm/resolve:260
    throw new ERR_MODULE_NOT_FOUND(
          ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../dusa/lib/cli.js' imported from .../dusa/dusa
    at finalizeResolution (node:internal/modules/esm/resolve:260:11)
    at moduleResolve (node:internal/modules/esm/resolve:921:10)
    at defaultResolve (node:internal/modules/esm/resolve:1124:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:526:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
    at onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:484:36)
    at TracingChannel.tracePromise (node:diagnostics_channel:337:14)
    at ModuleLoader.import (node:internal/modules/esm/loader:483:21)
    at defaultImportModuleDynamicallyForModule (node:internal/modules/esm/utils:214:31) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///.../dusa/lib/cli.js'
}

A quick look shows that the dusa executable awaits this file from the lib/ subdirectory, but this subdirectory does not exist.

I circumvented the issue by running

npm link dusa

in the home directory and afterwards

dusa examples/mutual-exclusion.dusa

runs fine. But maybe I'm missing something from the README?

minsungc avatar Feb 04 '25 21:02 minsungc

I've proposed a fix, but I'd like to leave this issue open even if we merge this, because what I really want is to have this fix built-in to the dusa command line program: before running await import('./lib/cli.js') we should test for the presence of ./lib/cli.js and then suggest running npm i && npm run lib if that file doesn't exist (and then exiting).

robsimmons avatar Feb 05 '25 16:02 robsimmons