mpizenberg / elm-test-rs

Fast and portable executable to run your Elm tests
BSD 3-Clause "New" or "Revised" License
81 stars 13 forks source link

Error: Cannot find module '../binary.js' #123

Closed tankorsmash closed 1 year ago

tankorsmash commented 1 year ago

Hey there! This is a fresh install of elm-test-rs on Windows 10, and it's throwing the following error:

$ elm-test-rs --version
node:internal/modules/cjs/loader:959
  throw err;
  ^

Error: Cannot find module '../binary.js'
Require stack:
- C:\Users\tankorsmash\AppData\Roaming\npm\node_modules\elm-test-rs\elm-test-rs.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\tankorsmash\AppData\Roaming\npm\node_modules\elm-test-rs\elm-test-rs.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\tankorsmash\\AppData\\Roaming\\npm\\node_modules\\elm-test-rs\\elm-test-rs.js'
  ]
}

I installed elm-test-rs via npm install -g elm-test-rs. Going into my local files and changing the import from ../binary.js to ./binary.js no longer throws any error, but not sure if that's because of some config on my end!

https://github.com/mpizenberg/elm-test-rs/blob/e48a853dab940acd5c44a413ae577612fdbd0ecf/npm/elm-test-rs.js#L5

lydell commented 1 year ago

Oops, I missed that in my PR (https://github.com/mpizenberg/elm-test-rs/pull/121). How embarrassing!

The reason we haven’t noticed is because we must have forgotten to test on Windows 😅 It works on macOS and Linux because of an optimization that replaces elm-test-rs.js with the real binary. (That optimization is not possible on Windows.)

Feel free to make a PR deleting that extra .!

mpizenberg commented 1 year ago

This issue is now fixed via #124 and published in version 3.0.0-5.

tankorsmash commented 1 year ago

Thanks for the quick turnaround on this!