Improve error message when NodeJS is not installed and 'nim js -r' is run (#18978)

This commit is contained in:
Juan Carlos 2021-10-12 06:41:30 -07:00 • committed by GitHub
commit 0ae2d1ea88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,5 +3,8 @@ import os
proc findNodeJs*(): string {.inline.} = proc findNodeJs*(): string {.inline.} =
## Find NodeJS executable and return it as a string. ## Find NodeJS executable and return it as a string.
result = findExe("nodejs") result = findExe("nodejs")
if result == "": if result.len == 0:
result = findExe("node") 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)