diff options
author | Juan Carlos <juancarlospaco@gmail.com> | 2021-10-12 06:41:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-12 15:41:30 +0200 |
commit | 0ae2d1ea88fdc7b6910ddbc960c7db086be383e4 (patch) | |
tree | 8808c14dafe1eda1a6b72ca1cd2807b737c98038 /compiler/nodejs.nim | |
parent | 83128f217f63045974a48e61b65386abbfc97352 (diff) | |
download | Nim-0ae2d1ea88fdc7b6910ddbc960c7db086be383e4.tar.gz |
Improve error message when NodeJS is not installed and 'nim js -r' is run (#18978)
Diffstat (limited to 'compiler/nodejs.nim')
-rw-r--r-- | compiler/nodejs.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/nodejs.nim b/compiler/nodejs.nim index 781035bb7..283643e8d 100644 --- a/compiler/nodejs.nim +++ b/compiler/nodejs.nim @@ -3,5 +3,8 @@ import os proc findNodeJs*(): string {.inline.} = ## Find NodeJS executable and return it as a string. result = findExe("nodejs") - if result == "": + if result.len == 0: result = findExe("node") + if result.len == 0: + echo "Please install NodeJS first, see https://nodejs.org/en/download" + raise newException(IOError, "NodeJS not found in PATH: " & result) |