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

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

Open
minsungc opened this issue Feb 4, 2025 · 1 comment
Open

Comments

@minsungc
Copy link

minsungc commented Feb 4, 2025

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?

@robsimmons
Copy link
Owner

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 added a commit that referenced this issue Feb 10, 2025
@minsungc found this problem in #108, which is mostly just an
unfortunate issue with NPX, and I agree it's worth flagging the problem.
My proposed suggestion is a bit different from Minsung's.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants