Skip to content

Disable REPL in node binary #5079

Answered by sanjeevWeb
wooffie asked this question in Q&A
Discussion options

You must be logged in to vote

By default, Node.js has no built-in option to disable the REPL interactive shell entirely at the binary level. Running node with no arguments launches the REPL, but there is no official CLI flag to disable it globally and i believe there is no any built-in method that does this job globally.

I have this solution for now -

Custom wrapper script: Create a small wrapper that checks if a filename is passed. If not, exit or show an error; otherwise, exec Node with the supplied file. Set this script as the intended entry point instead of the raw node binary.

(Very advanced even i cannot do it precisely but there is chances) - You could patch the source code so that the binary exits with an erro…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by avivkeller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants