summary refs log tree commit diff stats
path: root/compiler/nodejs.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/nodejs.nim')
-rw-r--r--compiler/nodejs.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/nodejs.nim b/compiler/nodejs.nim
new file mode 100644
index 000000000..9753e1c99
--- /dev/null
+++ b/compiler/nodejs.nim
@@ -0,0 +1,10 @@
+import std/os
+
+proc findNodeJs*(): string {.inline.} =
+  ## Find NodeJS executable and return it as a string.
+  result = findExe("nodejs")
+  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")