lukeed/uvu

Uvu CLI not available: "uvu: not found"

Lucasmiguelmac opened this issue · 10 comments

I can succesfully run isolated tests vía the node -r tsm tests/MyTest.ts command. Yet whenever I try to run uvu -r tsm tests or any command that starts with uvu, I get the following error:

uvu: not found

I have uvu 0.5.5 installed:
image

I would need to see the repository so I can reproduce locally. The combination definitely works, but there's something going on / some interplay with the rest of your setup.

@lukeed I created this public repo for you to have a better look.

There’s no test script. What do you want me to run?

I did not make any script because, as I mentioned, I'm not able to run any command starting with uvu. What I wish is to be able to run uvu -r tsm tests.

The point of a reproduction is that it’s exactly in a state to reproduce your issue. Please add a branch or something that does this so I don’t have to manually intervene/alter the initial state just to begin.

Sorry. I can't tell where did I give the impression of the opposite, but the repo I shared with you is the exact code I'm finding the error at.

There's a caveat though, which you can find in the readme I made for you, and it is that I work on a containerized environment.

The exact error can be reproduced following this steps:

  • Lift the container running docker-compose up -d in the workdir.
  • Get inside the container's terminal running docker exec -it svelte_template sh
  • Inside there, running uvu -r tsm tests to see that uvu cannot be find
  • (optional) inside there, you can also run npm list to check for yourself uvu is listed as an installed package.

Anyways, if you think a branch with a command is what you need, I just pushed a branch named command in this same repo with a command.sh (you can run it by running /bin/bash ./command.sh) that will get you inside the frontend container. Once you are there, you can try any command starting with uvu (like uvu -r tsm tests for example), to reproduce the exact error I'm having.

Please lmk if I understood you correcly. And sorry for any inconviniences caused.

UPDATE: I tried it using my system (instead of the container) and still didn't work. So the new steps to reproduce this simplified version of the problem would be:

  • Clone the repo
  • Run uvu and see the uvu: command not founderror.

Already fixed it. I had to install both uvu and tsm globally. It would be nice if this instruction (npm install uvu -g + npm install tsm -g) were added at the README installation instructions.

No, this is how npm works. If I understand your additional comments correctly – and pairing it with your lack of "test" script in your package.json – you were trying to run uvu -r tsm ... directly in your command line, which is asking for a global uvu executable For that, you do have to have uvu (or any) installed globally.

Had you had this in your package.json:

// package.json
{
  "scripts": {
    // ...
    "test": "uvu -r tsm tests"
  }
}

And then run npm test, it would have worked because npm is invoked & told to run uvu ... which looks at the project's own dependencies for the uvu binary (and a tsm package). This is true for yarn and everything else.

Ok, didn't got that part. Thank you very much!