mainmatter / compare-fixture

1 stars 0 forks source link

Running command not working #6

Closed oscard0m closed 9 months ago

oscard0m commented 1 year ago

Things I've tried

Running with npx

npx compare-fixture pkg-pika pkg

Output: (Node v16.20.0 or Node v14.21.3)

npx: installed 12 in 1.304s
/Users/XXX/.npm/_npx/34130/bin/compare-fixture: line 1: import: command not found
/Users/XXX/.npm/_npx/34130/bin/compare-fixture: line 3: const: command not found
/Users/XXX/.npm/_npx/34130/bin/compare-fixture: line 4: const: command not found
/Users/XXX/.npm/_npx/34130/bin/compare-fixture: line 6: try{: command not found
/Users/XXX/.npm/_npx/34130/bin/compare-fixture: line 7: syntax error near unexpected token `fixtureDir,'
/Users/XXX/.npm/_npx/34130/bin/compare-fixture: line 7: `  compareFixture(fixtureDir, comparisonDir);'

Output: (Node v18.15.0)

npx: installed 12 in 2.79s
Command failed: compare-fixture spawn Unknown system error -8

Cloning the project and running it

node cli.js ../octokit/webhooks.js/pkg-pika ../octokit/webhooks.js/pkg

Output:

internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/Users/XXX/dev/open_source/compare-fixture/' is not supported resolving ES modules imported from /Users/XXX/dev/open_source/compare-fixture/cli.js
Did you mean to import ../index.js?
    at new NodeError (internal/errors.js:322:7)
    at finalizeResolution (internal/modules/esm/resolve.js:314:17)
    at moduleResolve (internal/modules/esm/resolve.js:776:10)
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:887:11)
    at Loader.resolve (internal/modules/esm/loader.js:89:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:76:40)
    at link (internal/modules/esm/module_job.js:75:36) {
  code: 'ERR_UNSUPPORTED_DIR_IMPORT',
  url: 'file:///Users/XXX/dev/open_source/compare-fixture/'
}

Possible solution:

Doing this change fixes the issue for me:

- import compareFixture from ".";
+ import compareFixture from "./index.js";

I'm happy to help on this and am open to submitting a PR.

mansona commented 9 months ago

I think this is less about the version of node you are using and more about the version of npm 🤔 I just tried this today with someone and it worked, can you try again and see if it's ok for you?

mansona commented 9 months ago

Actually looking at your error I knew exactly what was wrong! It's fixed now 👍