Orange-OpenSource / hurl

Hurl, run and test HTTP requests with plain text.
https://hurl.dev
Apache License 2.0
12.96k stars 486 forks source link

Could not find exe at path xx Please ensure the hurl 'postinstall' script runs on install. #2774

Closed boly38 closed 5 months ago

boly38 commented 5 months ago

What is the current bug behavior?

Can't install hurl globally without having path issue (tested on git bash + WSL2)

Steps to reproduce

# @orangeopensource/hurl 4.3.1
# npm remove -g @orangeopensource/hurl
npm i -g @orangeopensource/hurl
hurl --version

(REDACTED\AppData\Roaming\npm\node_modules\@orangeopensource\hurl\bin.js:52
        throw new Error("Could not find exe at path '" + exePath + "'. Please ensure the hurl 'postinstall' script runs on install.");
                                                         ^

ReferenceError: exePath is not defined
    at throwIfNoExePath ((REDACTED\AppData\Roaming\npm\node_modules\←[4m@orangeopensource←[24m\hurl\bin.js:52:58)

What is the expected correct behavior?

I expect having hurl in command current path (or at least hurl.exe)

Execution context

package version is version": "4.3.1" else

(REDACTED)AppData/Roaming/npm/node_modules/@orangeopensource/hurl/dist/hurl.exe --version
hurl 4.3.0 (Windows) libcurl/8.4.0-DEV Schannel zlib/1.3 nghttp2/1.58.0
Features (libcurl):  alt-svc AsynchDNS HSTS HTTP2 IPv6 Largefile libz NTLM SPNEGO SSL SSPI Unicode UnixSockets
Features (built-in): brotli

Possible fixes

What I noticed that could maybe help

So with a fix on that variable, the error message become

hurl --version
(REDACTED)Roaming\npm\node_modules\@orangeopensource\hurl\bin.js:52
        throw new Error("Could not find exe at path '" + execPath + "'. Please ensure the hurl 'postinstall' script runs on install.");
        ^

Error: Could not find exe at path '(REDACTED)AppData\Roaming\npm\node_modules\@orangeopensource\hurl\dist\bin\hurl.exe'. Please ensure the hurl 'postinstall' script runs on install.
    at throwIfNoExePath ((REDACTED)AppData\Roaming\npm\node_modules\←[4m@orangeopensource←[24m\hurl\bin.js:52:15)

NB: please replace (REDACTED) by current user home directory (ex. C:\Users\Jack\)

Possible workaround

here is the current workaround I'm using

alias hurl='$HOME/AppData/Roaming/npm/node_modules/@orangeopensource/hurl/dist/hurl.exe'

But as alias is not available from some context (ex. Makefile), you could define a symlink instead (dont forget to remove it after the fix)

# git bash
ln -s "$HOME/AppData/Roaming/npm/node_modules/@orangeopensource/hurl/dist/hurl.exe" /usr/bin/hurl
# WSL2 
$ sudo ln -s "/mnt/c/Users/Jack/AppData/Roaming/npm/node_modules/@orangeopensource/hurl/dist/hurl.exe" /usr/local/bin/hurl
lepapareil commented 5 months ago

Hi @boly38, thanks for this issue, we'll try to reproduce it to understand what's wrong with the npm installation.

For now, considering your workspace, I can recommend adopting natives installation procedures:

jcamiel commented 5 months ago

@boly38 @lepapareil it should be fixed with Hurl npm package 4.3.2, @boly38 can you test it on Windows ?

Thanks for the report !

boly38 commented 5 months ago

I just added a small remark to the PR, anyway 4.3.2 is working well, huge thanks 🙏 amazing support 👍