Recent

Author Topic: npx not found (after install with nvm) [solved]  (Read 5331 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 8030
Re: npx not found (after install with nvm)
« Reply #15 on: June 13, 2024, 08:59:08 am »
Fine. And as I said, a TProcess wants the name an ELF file.

A Javascript file is not an ELF file, it's text.

A shebang is not handled specially, it's text.

It might be fixable by asking a TProcess to run /usr/bin/env etc., or you might have to ask it to run the node binary (wherever it is) with a bit of fossicking around with explicitly provided shell (environment) variables, or you might just be able to do it by invoking a shell. That's your problem as a Javascript etc. user, not ours.

This is hardly the first time I've seen this sort of thing, in fact it might not even be the first time this week. I suspect that @TRon's sitting there giggling :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Michael Collier

  • Sr. Member
  • ****
  • Posts: 323
Re: npx not found (after install with nvm) [solved]
« Reply #16 on: July 08, 2024, 06:11:57 pm »
To solve the problem of PATH not containing the path information I needed, I ended up using the -c or /c option for executing terminal commands as a string and inserting the code to modify the PATH variable first..

e.g. Linux
cmd_test = 'export PATH="$PATH:/home/user1/.nvm/versions/node/v21.7.3/bin/"; npx -v' ;

I had to play around with quotation marks ` and ' and " , but it works on windows / linux and Mac.

Thanks,
Mike

 

TinyPortal © 2005-2018