summary refs log tree commit diff stats
path: root/compiler/nodejs.nim
diff options
context:
space:
mode:
authorJuan Carlos <juancarlospaco@gmail.com>2021-10-12 06:41:30 -0700
committerGitHub <noreply@github.com>2021-10-12 15:41:30 +0200
commit0ae2d1ea88fdc7b6910ddbc960c7db086be383e4 (patch)
tree8808c14dafe1eda1a6b72ca1cd2807b737c98038 /compiler/nodejs.nim
parent83128f217f63045974a48e61b65386abbfc97352 (diff)
downloadNim-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.nim5
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)