Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler: don't raise when NodeJS is missing #812

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions compiler/nim.nim
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,17 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef, argv: openArray[string]):
case conf.backend
of backendC: discard
of backendJs:
# D20210217T215950:here this flag is needed for node < v15.0.0, otherwise
# tasyncjs_fail` would fail, refs https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode
if cmdPrefix.len == 0: cmdPrefix = findNodeJs().quoteShell
cmdPrefix.add " --unhandled-rejections=strict"
let nodejs = findNodeJs()
if nodejs.len > 0:
# D20210217T215950:here this flag is needed for node < v15.0.0, otherwise
# tasyncjs_fail` would fail, refs https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode
if cmdPrefix.len == 0: cmdPrefix = nodejs.quoteShell
cmdPrefix.add " --unhandled-rejections=strict"
else:
conf.logError:
"NodeJS not found in path. For installing it, refer to " &
"https://nodejs.org/en/download"
return
of backendNimVm:
if cmdPrefix.len == 0:
cmdPrefix = changeFileExt(getAppDir() / "vmrunner", ExeExt)
Expand Down
3 changes: 0 additions & 3 deletions compiler/utils/nodejs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@ proc findNodeJs*(): string {.inline.} =
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: " & result)
Loading