rtfeldman/node-test-runner

elm-test doesn't work with Yarn 2

Closed this issue · 3 comments

Hi, I'm trying to migrate a project to yarn 2 (3.2.1) with PnP, but I have an issue when i try to run elm-test, everything works with yarn 1

node@project:/code$ yarn elm-test
/code/.yarn/unplugged/elm-npm-0.19.1-5-63dbdb9c23/node_modules/elm/bin/elm:1
�ELF
^

SyntaxError: Invalid or unexpected token
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1033:15)
    at Module._compile (node:internal/modules/cjs/loader:1069:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Object.require$$0.Module._extensions..js (/code/.pnp.cjs:23838:33)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.require$$0.Module._load (/code/.pnp.cjs:23661:22)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:170:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
    at async Promise.all (index 0)

`elm make` failed with exit code 1.

if I try to run it with npx, npx say that needs to install the package.

Update:
I tried with nodeLinker: node-modules and still doesn't work

Hi!

What happens if you run npx elm --help or yarn elm --help in the same directory?

elm-test just tries to execute elm and expects it to be in $PATH. npx and yarn add ./node_modules/.bin to $PATH, and people usually have elm in there so that’s how it works. But in your case, it looks like something expects node_modules/elm/bin/elm to be a Node.js script, while in reality it seems to be the Elm binary itself.

So from a quick look it doesn’t look like there’s a problem with elm-test – more of a problem of your installation of elm itself.

Thanks for your reply, I have the exact same result simply running elm.
I suspect more a yarn problem after your response, because if run the binary from its folder it works, i will try to open an issue on their side.

it's seems an old open issue on yarn side yarnpkg/berry#882 (comment)